Preheat the Oven: Begin by preheating your oven to 350°F (175°C) and greasing a 9x13-inch baking dish with butter or non-stick spray.
Sauté the Vegetables: In a large skillet over medium heat, add the olive oil and allow it to warm. Add the chopped onion and sauté for about 5 minutes until it becomes translucent. Stir in the garlic and cook for an additional minute until fragrant.
Cook the Mushrooms: Add the sliced mushrooms to the skillet, followed by the dried thyme, dried rosemary, salt, and pepper. Cook for 8-10 minutes, stirring occasionally, until the mushrooms release their moisture and start to brown. Remove from heat and set aside to cool slightly.
Prepare the Bread: In a large mixing bowl, combine the bread cubes and the sautéed mushroom mixture, ensuring the bread is evenly coated with the buttery juices.
Whisk the Custard: In another bowl, whisk together the eggs and milk until well combined. Season with a pinch of salt and pepper.
Combine All Ingredients: Pour the egg mixture over the bread and mushrooms, gently folding it together so every piece of bread is soaked in the custard. Let it sit for about 10 minutes to absorb the flavors.
Add Cheese: Fold in the Gruyère cheese and half of the Parmesan cheese into the mixture. Transfer the entire mixture into the prepared baking dish, spreading it out evenly. Sprinkle the remaining Parmesan cheese on top.
Bake: Place the baking dish in the preheated oven and bake for 35-45 minutes, or until the top is golden brown and the custard is set. A knife inserted in the center should come out clean.
Garnish and Serve: Once out of the oven, let the bread pudding rest for about 5-10 minutes. Garnish with fresh chopped parsley before serving warm.