Heat oven to 400°F. Toss onions and shallots with melted butter, oil, salt and pepper in a large roasting pan. Spread evenly.
Roast 70–85 minutes until soft and deeply golden, not blackened. Stir every 20 minutes, more often near the end. Transfer to a soup pot.
Add sherry and 1/2 cup measured broth to the warm roasting pan. Scrape up browned juices with a wooden spoon. Pour into soup pot; add remaining broth, thyme and bay leaf.
Simmer uncovered 20 minutes. Meanwhile, toast baguette on a baking sheet at 400°F, 6–8 minutes until crisp. Heat broiler.
Discard bay leaf. Divide soup among 6 broiler-safe bowls on a rimmed sheet. Top each with toast and equal portions of Gruyere. Broil 6 inches from heat, 2–4 minutes until bubbling and browned.
Rest 5 minutes. Warn diners: bowls are still hot.