Prepare the Dough: In a large mixing bowl, whisk together the flour and salt. In a separate bowl, whisk the egg, warm water, and sour cream. Gradually add the wet ingredients to the dry ingredients, mixing until a shaggy dough forms. Turn the dough out onto a lightly floured surface and knead for about 5-7 minutes until smooth and elastic. Cover the dough with a damp cloth and let it rest for at least 30 minutes.
Make the Filling: While the dough rests, mash the boiled potatoes until smooth. In a bowl, combine the mashed potatoes, farmer's cheese (or ricotta), sautéed onions, and butter. Season generously with salt and pepper. Mix well until thoroughly combined. Taste and adjust seasoning as needed.
Assemble the Pierogi: Divide the rested dough into two portions. Working with one portion at a time, roll it out on a lightly floured surface to about 1/8-inch thickness. Use a round cutter (about 3 inches in diameter) to cut out circles. Place about 1-2 teaspoons of filling in the center of each dough circle. Fold the dough over to create a half-moon shape, pressing the edges firmly to seal. Ensure there are no air pockets. You can crimp the edges with a fork for extra security or leave them as is.
Cook the Pierogi: Bring a large pot of salted water to a rolling boil. Carefully drop the pierogi into the boiling water, being careful not to overcrowd the pot. Cook for about 3-5 minutes, or until the pierogi float to the surface. Remove the cooked pierogi with a slotted spoon.
Serve the Pierogi: In a large skillet, melt the butter over medium heat. Add the chopped onion and sauté until golden brown and softened. Add the cooked pierogi to the skillet and gently toss to coat them in the butter and onions. Serve immediately, topped with a dollop of sour cream.