Caramelize the onions: Melt butter in a large pot or Dutch oven over medium heat. Add onions and cook, stirring occasionally, until deeply caramelized, about 30-40 minutes. This is the most important step, so be patient!
Deglaze and simmer: Pour in the white wine and scrape up any browned bits from the bottom of the pot. Add the beef broth, thyme, salt, and pepper. Bring to a simmer and cook for 15-20 minutes to allow the flavors to meld.
Broil or bake: Preheat your broiler or oven to 375°F (190°C). Place oven-safe bowls or ramekins on a baking sheet. Ladle the soup into the bowls.
Top with bread and cheese: Place a slice of French bread on top of each bowl of soup, and generously sprinkle with grated Gruyère cheese.
Broil or bake until golden brown: Broil or bake for 5-10 minutes, or until the cheese is melted and bubbly and the bread is golden brown. Watch carefully to prevent burning.
Serve immediately and enjoy!