In a large pot or Dutch oven over medium heat, heat the olive oil. Add the onions and saute until wilted. Add the sugar and continue cooking, stirring frequently, until the onions are richly colored and caramelized. (If they brown too quickly toward the beginning of the caramelizing process, reduce the heat.).
Preheat oven to 350 degrees.
Add the stock, bay leaf, salt, pepper, and wine to the pot. Cover partially and simmer until the flavors are well blended, at least 30 minutes.
Meanwhile, toast the baguette slices: Arrange slices in a single layer on a baking sheet and toast in the oven until golden, watching carefully to prevent burning, 5-7 minutes.
Add the thyme to the soup and season to taste with more salt or pepper. Discard the bay leaf.
To serve, preheat the broiler. Ladle the soup into individual ovenproof soup bowls. Place 2 or 3 baguette slices on top of each serving and sprinkle evenly with cheese. Broil approximately 4" from heat source in the oven. Broil until cheese is bubbly and lightly browned, 3-4 minutes. Serve at once.