In a large pot, melt the butter and olive oil over medium heat. Add the sliced onions and cook, stirring frequently, for about 30 minutes until they are caramelized and golden brown.
Stir in the minced garlic, sugar, salt, and pepper. Cook for an additional 2 minutes.
Sprinkle the flour over the onions and stir well to combine. Cook for 1-2 minutes to eliminate the raw flour taste.
Gradually add the beef broth and white wine, stirring constantly. Add the thyme and bay leaf. Bring the mixture to a simmer and cook for 30 minutes, allowing the flavors to meld.
While the soup simmers, preheat your oven to 400°F. Arrange the baguette slices on a baking sheet and toast in the oven for about 5-7 minutes until golden.
Remove the bay leaf from the soup. Ladle the soup into oven-safe bowls, top each with a few toasted baguette slices, and sprinkle generously with Gruyère cheese.
Place the bowls on a baking sheet and bake in the oven for 10-15 minutes, or until the cheese is bubbly and golden brown.