Place the sour cream in a large bowl, and mix in flour to make a dough. Roll the dough out on a floured surface about 1/16 inch thick, and cut rounds about 3 1/2 inches across using a cookie cutter or a glass. Re-roll the unused dough to make more rounds, up to 4 times — after that, it gets hard to work with.
Place about 1 teaspoon of mashed potatoes in the center of each dough round, fold over into a half-moon shape, and press and seal the edges with a fork. Set the filled pierogies aside under a towel to prevent drying.
Melt the butter in a large skillet over medium-low heat, and cook and stir the onions until translucent, 4 to 5 minutes. Remove the cooked onions and set aside, leaving butter in the skillet.
Bring a large saucepan of water to a boil, and carefully drop a few filled pierogies at a time into the boiling water. After they float to the surface, allow them to gently boil for about 4 minutes.
Re-heat the butter in the skillet over medium heat. Gently scoop the pierogies out of the water (they break easily) and place them in the skillet to brown on the bottom, about 3 minutes. Place the fried pierogies on a buttered baking sheet, sprinkle them with the cooked onions, and keep warm in the oven on low setting until served.