Peel all onions, trim ends, cut in half from root to stem, and slice into thin half-moons about 1/8 inch thick.
Melt butter with olive oil in a large Dutch oven over medium heat. Add onions, salt, and sugar, stir to coat. Cook uncovered for 15-20 minutes, stirring occasionally, until softened and translucent.
Reduce heat to medium-low and continue cooking for 35-45 minutes, stirring more frequently as they darken. Scrape up browned bits from the pot. Add a tablespoon or two of water if sticking or browning too fast. The onions are ready when they are a deep amber brown and smell sweet.
Stir in minced garlic and cook for 1 minute until fragrant. Pour in dry sherry, raise heat to medium-high, and scrape the pot constantly. Cook for 2-3 minutes until most of the sherry has reduced and the onions look glossy.
Pour in the beef broth, then add thyme sprigs, bay leaves, Worcestershire sauce, and black pepper. Bring to a gentle boil, then reduce heat to low and simmer uncovered for 25-30 minutes. Taste and adjust salt if needed, then remove and discard bay leaves and thyme stems.
While soup simmers, preheat oven to 400°F (200°C). Arrange baguette slices on a baking sheet and bake for 8-10 minutes, flipping halfway, until golden and crisp.
Set oven's broiler to high and position rack about 6 inches from heat. Place soup crocks on a rimmed baking sheet. Ladle hot soup into each crock. Top with toasted baguette slices, cover generously with shredded Gruyère, and sprinkle with Parmesan if using. Broil for 2-4 minutes until cheese is bubbling and lightly browned. Serve immediately.