In a large bowl, combine flour and salt. Add the beaten egg, sour cream, melted butter, and gradually mix in enough warm water to form a soft, pliable dough.
Knead the dough on a floured surface until smooth, about 5-7 minutes. Cover with a clean towel and let it rest for 20 minutes.
For the filling, boil the potatoes until tender, about 15 minutes. Drain and mash with shredded cheddar cheese, black pepper, and a pinch of salt until smooth and creamy.
Roll out the dough on a floured surface to about 1/8-inch thickness. Cut out circles using a 3-inch round cutter.
Place a spoonful of the potato-cheese filling on each dough circle. Wet the edges with water, fold over, and press to seal.
Bring a large pot of salted water to a boil. Cook pierogi in batches until they float to the top, about 3 minutes. Remove with a slotted spoon.
In a skillet, sauté the chopped onion in butter until golden. Add boiled pierogi and cook until crisp and browned on both sides.
Serve hot with a side of sour cream.