Special equipment: a 3-quart baking dish
Melt the butter and oil in a large Dutch oven or pot over medium heat. Add half the onions and celery, 1/2 teaspoon salt and a few grinds of pepper. Top with the remaining onions and celery, 1/2 teaspoon salt, a few grinds of pepper, the bay leaves and the thyme sprigs. Cook, uncovered and stirring occasionally, until all the liquid evaporates and the onions are very soft and golden brown, 45 minutes to 1 hour. (If the onions are soft but could be more golden, increase the heat slightly for a few minutes toward the end of cooking.)
Add the flour, and stir until completely absorbed, about 1 minute. Add the broth and wine, and simmer until almost completely evaporated, about 2 minutes. Remove from the heat, and let cool for a few minutes. Remove the bay leaves and thyme stems. (The onions can be made, cooled and refrigerated up to 2 days ahead.)
Meanwhile, preheat the oven to 350 degrees F. Bake the baguette slices on a baking sheet until they're slightly toasted but not golden, 2 to 3 minutes per side. Let cool.
Shingle and slightly overlap half the bread slices in a 3-quart flameproof baking dish. Top with the onion mixture in 1 layer. Shingle, overlapping, with the remaining bread. Sprinkle the Gruyere over the top. Cover with foil, and bake until the onion mixture is hot and the cheese is melted, about 40 minutes. Remove the foil, switch the oven from bake to broil and broil until the top is golden in spots. Sprinkle the thyme leaves over the top. Serve hot.
Copyright 2015 Television Food Network, G.P. All rights reserved.