Melt the butter and olive oil in a large pot over medium heat.
Add the sliced onions and cook, stirring occasionally, for about 20 minutes until caramelized.
Sprinkle the sugar over the onions to enhance caramelization.
Once the onions are golden brown, add the thyme and bay leaf.
Pour in the wine and cook for about 5 minutes, scraping the bottom of the pot.
Add the beef broth and season with salt and pepper.
Bring the soup to a simmer and let it cook for 30 minutes.
Meanwhile, preheat the oven to 350°F (175°C).
Arrange the baguette slices on a baking sheet and toast until golden.
Serve the soup in bowls, topping each with toasted bread and a generous amount of Gruyère cheese.
Bake in the oven until the cheese is bubbly and golden, about 10 minutes.