Gather all ingredients. Preheat the oven to 425 degrees F (220 degrees C) with rack in middle position.
Combine onions, oil, and thyme sprigs in a heavy-bottomed pot or large Dutch oven.
Bake, covered, in the preheated oven, stirring once halfway through, until onions are wilted and lightly browned, about 40 minutes. Uncover and continue cooking, stirring occasionally, until onions are golden brown and caramelized, about 30 minutes more.
Remove from oven and stir in sherry. Cook over medium, stirring constantly, scraping up any browned bits from bottom and sides of pot, until liquid has mostly evaporated, about 3 minutes.
Stir in broth, Worcestershire, pepper, salt, and bay leaf; bring to a boil over high. Reduce heat to medium-low, and simmer, undisturbed, allowing flavors to meld together, about 15 minutes. Remove from heat and stir in cider vinegar. Discard thyme sprigs and bay leaf.
Increase oven temperature to broil. Ladle soup evenly into 6 broiler-proof bowls or crocks, and place bowls on a large rimmed baking sheet. Top each bowl with 2 bread slices and about 1/3 cup Gruyère.
Broil until Gruyère is bubbly and bread is browned in places, 3 to 5 minutes. Garnish with thyme leaves and serve immediately.