How to Make It
Preheat oven to 375°F. Grease a 13- x 9-inch baking dish with 1 tablespoon of the butter.
Bring a large saucepan of salted water to a boil over high. Add green beans, and cook until beans are tender, 7 to 9 minutes. Drain and set beans aside.
Melt 3 tablespoons of the butter in a large skillet over medium. Add sliced onions, 1 teaspoon of the salt, and 1/2 teaspoon of the pepper, and cook, stirring occasionally, until onions are deeply golden brown and very aromatic, 24 to 28 minutes. If your onions are cooking too fast and beginning to burn, lower the heat accordingly. Once onions are deeply golden brown, add sherry, and cook, stirring constantly, 1 minute. Transfer onions to a plate; do not wipe skillet clean.
Heat remaining 3 tablespoons butter in skillet over medium-high until melted. Add flour, and cook, stirring constantly, until well blended. Gradually add half-and-half, and cook, stirring constantly, until well blended, about 1 minute, scraping to release any flour mixture from bottom of skillet. Bring to a boil, and boil, stirring often, until mixture thickens slightly, about 2 minutes. Remove skillet from heat, and add Gruyère cheese and remaining 1 teaspoon salt and 1/4 teaspoon pepper, stirring until cheese melts (about 15 seconds). Fold in green beans, making sure beans are evenly coated. Spoon green bean mixture into prepared baking dish.
Top green bean mixture evenly with 1 cup of the Parmesan cheese. Sprinkle with thyme and caramelized onions. Stir together remaining 1/2 cup Parmesan cheese and panko in a small bowl; sprinkle evenly over caramelized onions. Lightly spray Parmesan-panko topping with cooking spray.
Cover with aluminum foil, and bake in preheated oven 15 minutes. Remove foil, and bake until topping is golden brown and crisp, about 15 more minutes. Garnish with additional thyme, and serve immediately.