Preheat oven to 425 degrees F. Grease a 8x8-inch baking dish.
Heat 2 tablespoons oil in a large saute pan over medium-high heat. Add mushrooms and saute until all of the water from the mushrooms have evaporated. Season with salt and pepper and remove from the pan.
Heat the remaining 2 tablespoons oil in the saute pan. Add shallots and garlic and saute until softened. Add flour, thyme, and rosemary, stirring to combine. Add back the sauteed mushrooms along with sherry, vegetable stock, and heavy cream. Bring to a simmer, reduce heat to low, and cook for 3-4 minutes or until thickened, stirring frequently. Season filling with salt and pepper.
Meanwhile, combine panko, parmesan, and Italian seasoning in a medium bowl. Add melted butter, stirring until well combined.
Transfer mushroom filing to prepared baking dish. Sprinkle breadcrumb topping evenly on top and bake mushroom gratin for 10-12 minutes or until golden brown. Remove from heat and let cool 5 minutes. Top with chopped parsley and serve.
Notes
You can make the breadcrumb topping and mushroom ahead of time. Top the mushroom filling with the breadcrumb topping right before baking.