1/4 cup unsalted butter
5 medium Vidalia onions, thinly sliced (about 3 lb.)
2 tsp. kosher salt
1/2 tsp. black pepper
3 thyme sprigs
2 flat-leaf parsley sprigs
2 bay leaves
1 (16-oz.) baguette, thinly sliced
1/3 cup all-purpose flour
3 cups reduced-sodium beef broth
1/2 cup sherry
8 oz. Gruyère cheese, shredded (about 2 cups)
1 tsp. fresh thyme leaves
Melt butter in a Dutch oven over medium-low; add onions, salt, pepper, thyme and parsley sprigs, and bay leaves; cook, stirring often, until onions are golden brown, about 1 hour.
Meanwhile, preheat oven to 350°F. Arrange baguette slices in a single layer on a baking sheet. Bake in preheated oven until lightly toasted, 12 minutes. Set aside.
Remove and discard thyme and parsley sprigs and bay leaves from onion mixture. Add flour, and cook, stirring constantly, 2 minutes. Add broth and sherry; bring to a boil over high. Boil, stirring constantly, until slightly thickened, 2 to 3 minutes.
Layer half of the toasted baguette slices in a 13- x 9-inch baking dish. Spoon onion mixture evenly over bread. Top evenly with remaining baguette slices. Sprinkle with cheese; cover with aluminum foil.
Bake in preheated oven 30 minutes. Increase heat to broil. Remove foil; broil until cheese is bubbly, about 3 minutes. Sprinkle with thyme leaves.