Warm butter and oil in a heavy pot over medium heat.
Add onions, salt, and sugar. Cook slowly, stirring often, until deep golden, 35–45 minutes.
Stir in minced garlic and cook 1 minute until fragrant.
Sprinkle in flour and cook 1 minute, stirring to coat the onions.
Deglaze with white wine, scraping up browned bits; simmer 2–3 minutes to reduce slightly.
Pour in vegetable broth. Add thyme, soy sauce, and black pepper. Simmer gently 20–25 minutes.
Toast baguette slices under the broiler until crisp; set aside. Heat broiler to high.
Ladle soup into broiler-safe bowls. Top with toasts and a mound of Gruyère. Broil until bubbling and browned.
Finish with a splash of sherry vinegar if using. Serve hot.