Caramelize the Onions: Melt butter (and optional olive oil) in a heavy-bottomed pot over medium heat. Add sliced onions and cook slowly for 30–40 minutes, stirring occasionally, until they turn golden brown and sweetly fragrant.
Prepare the Broth: Add minced garlic, thyme, and bay leaves to the onions. Deglaze the pan with white wine, scraping up any browned bits. Pour in the beef stock and simmer gently for 20 minutes. Season with salt and pepper to taste.
Assemble the Soup: Preheat your oven to 375°F (190°C). Pour the soup into ovenproof bowls, top each bowl with toasted baguette slices, and sprinkle generously with grated Gruyère cheese.
Bake and Broil: Bake the bowls for 15 minutes until the cheese melts. For a golden, bubbly crust, broil for an additional 2–3 minutes.
Serve: Garnish with fresh thyme or parsley if desired. Serve immediately while hot and enjoy the rich, comforting flavors.