Preheat your oven to 180°C (350°F). Prepare a 2-quart baking dish and set aside.
Heat the butter in a large skillet over medium heat until it melts and begins to sizzle gently.
Add the chopped onions and minced garlic to the skillet. Cook, stirring often, until the onions are translucent and fragrant, about 5 minutes. The mixture should smell sweet and pungent, with the onions turning slightly golden.
Stir in the chopped wild mushrooms, season with salt and pepper, and sauté until the mushrooms are golden and their earthy aroma fills the kitchen, about 8-10 minutes. If excess water collects, cook a little longer until it evaporates and mushrooms deepen in color.
In a mixing bowl, whisk together the heavy cream, grated Gruyère, chopped thyme, and a pinch of salt and pepper. Pour this mixture into the skillet with the mushrooms, stirring gently to combine. Cook for another 2-3 minutes until the sauce thickens slightly and the cheese begins to melt into a creamy, bubbly mixture.
Transfer the mushroom and sauce mixture into your prepared baking dish, spreading it evenly with a spatula. In a small bowl, mix the Panko breadcrumbs with a little grated Parmesan if using, and sprinkle this evenly over the top of the casserole.
Bake uncovered in the preheated oven for 20-25 minutes, until the top is golden brown and bubbling around the edges. The aroma of toasted breadcrumbs and melted cheese should waft through your kitchen.
Remove the casserole from the oven and let it rest for 5 minutes. This helps it set slightly and makes serving easier. The top should be crispy, and the filling creamy and fragrant with earthy mushroom goodness.
Garnish with additional thyme leaves or fresh herbs if desired. Serve warm, ideally with crusty bread or a simple side salad to complement the rich, earthy flavors.