Preheat the oven to 375°F (190°C). Line a small baking sheet with parchment paper or use a large baking dish.
Toss the chopped onions with the melted butter and spread them into a thin layer on the baking sheet.
Roast, stirring every 10 minutes, until the onions are soft, smell sweet, and turn a light golden color, 50 to 60 minutes. Keep a closer eye towards the end of the cooking time to ensure the onions do not overbrown.
Transfer the onions while they are still hot to a mixing bowl and scrape all the butter left in the pan into the bowl with the onions.
Stir in the salt, pepper, and sour cream.
Cover and refrigerate overnight, and then serve. The dip will last up to 4 days in the fridge. Stir well before serving.
