In a large heavy-bottomed pot or Dutch oven, heat butter and olive oil over medium heat until butter is melted. Add the thinly sliced onions and kosher salt, stirring to coat.
Cook the onions, stirring frequently, until they soften, about 10 minutes. Sprinkle in the granulated sugar and continue cooking over medium-low heat, stirring occasionally, until the onions are deeply golden and caramelized, about 25 to 30 minutes.
Increase heat to medium-high and pour in the dry white wine to deglaze the pan, scraping up browned bits from the bottom. Simmer until the wine has mostly evaporated, about 2 to 3 minutes.
Add the beef broth, fresh thyme leaves, and bay leaf. Bring the soup to a gentle simmer, then reduce heat and simmer uncovered for 15 to 20 minutes to meld flavors. Taste and adjust seasoning with salt and freshly ground black pepper.
While the soup simmers, preheat the broiler. Arrange the baguette slices on a baking sheet and toast under the broiler until golden on both sides, about 1 to 2 minutes per side.
Ladle the hot soup into ovenproof bowls. Float one or two toasted baguette slices on each bowl and top generously with grated Gruyère cheese.
Place the bowls on a baking sheet and put under the broiler until the cheese is melted, bubbly, and lightly browned, 2 to 4 minutes—watch carefully to avoid burning.
Carefully remove the hot bowls from the oven, discard the bay leaf, garnish with additional thyme if desired, and serve immediately.
Notes
Use good-quality beef broth and take your time caramelizing the onions for the best depth of flavor. For a vegetarian version, substitute a rich mushroom or vegetable stock and use a plant-based cheese if desired.