Melt the butter in a large soup pot over medium-high heat, then add in the sliced onions and a generous pinch of salt. Cook on medium-high heat for about 10 minutes, stirring occasionally so that the onion does not burn. Reduce heat to medium-low to caramelize gradually. This will take some time, about 30 minutes.
When the onions have caramelized to a golden brown color, add in the flour and cook, stirring, for 1 minute. Next, deglaze with the dry sherry. Continue stirring until most of the sherry is evaporated then add the thyme, Worcestershire, vinegar, and mushroom stock. Simmer on low for 20-30 minutes. Season to taste with salt and pepper.
Preheat the oven to 400°F. While the soup is simmering, slice the baguette into 1/4-inch thick pieces and arrange them in a single layer on a baking sheet. Bake for 5 minutes, until the bread is toasted and golden around the edges. Remove and set aside.
Switch the oven to broil. Ladle the soup into oven-safe bowls. Add 1-2 slices of toasted baguette to each and top with two slices of cheese. Place each soup bowl on a baking sheet and transfer to the oven, broil until bubbly and golden brown, 2 to 3 minutes. Serve immediately!