In a large Dutch oven or other large pot, melt 3 tablespoons butter over medium heat. Add the oil and onions; cook onions are until softened, stirring occasionally, about 15 minutes. Add the salt, pepper, and sugar; continue to cook, stirring occasionally, until onions are deep golden brown and caramelized, reducing heat slightly if onions seem to be browning too quickly, 35 to 45 minutes more.
Add wine and raise heat to high. Cook until almost all liquid has evaporated, 8 to 10 minutes.
Tie thyme and bay leaves into a bundle with twine. Add broth and herb bundle to pot with onions. Bring to a boil, reduce to a simmer, and cook, uncovered, until broth is thickened and flavorful, 20 to 30 minutes. Remove from heat and whisk in remaining 2 tablespoons butter. Taste and adjust seasoning.
Heat the broiler. Cut two 1/2-inch baguette slices for every serving of soup. Place baguette slices on a rimmed baking sheet and toast in oven until crisp and dry but not browned, about 1 minute per side. Rub one side of each toast with the garlic clove and set aside.
Place ramekins or ovensafe bowls on a rimmed baking sheet, add 1/2 teaspoon of sherry to the bottom of each, and ladle soup on top. Top each serving of soup with two garlic-rubbed toasts. Divide cheese among the servings, covering the bread and some of the soup. Carefully transfer baking sheet to oven and broil until cheese is melted and bubbling, 4 to 8 minutes. (Alternatively, if using regular soup bowls: Top each garlic-rubbed toast with some cheese and return to broiler to melt, about 2 minutes more. Divide sherry and soup among bowls, sprinkle with remaining cheese, and top each serving with two cheese toasts.)
Soup can be made up to 3 days ahead (without toasts or cheese) if refrigerated, or up to 6 months ahead if frozen. Toasts can be made (without cheese) and kept sealed at room temperature for up to 3 days.