In a large pot, melt the butter and olive oil over medium heat. Add the sliced onions and stir to coat. Sprinkle with salt and sugar (if using). Cook the onions, stirring frequently, for about 30-40 minutes until they are deep golden brown and caramelized.
Pour in the white wine, scraping the bottom of the pot to deglaze. Cook for about 5 minutes until the wine reduces slightly. Add the beef broth, thyme, bay leaf, and pepper. Bring to a simmer and cook for another 20-30 minutes to develop the flavors. Adjust seasoning if needed.
While the soup simmers, preheat your oven to 400°F (200°C). Arrange the baguette slices on a baking sheet and toast until golden, about 5-7 minutes.
Remove the thyme sprigs and bay leaf from the soup. Ladle the soup into oven-safe bowls. Place a slice of toasted baguette on top of each bowl, then sprinkle generously with Gruyère cheese.
Place the bowls on a baking sheet and broil in the oven until the cheese is melted and bubbly, about 2-4 minutes. Keep an eye on them to prevent burning!