Preheat the oven to 400°F. Grease a 2-quart baking dish with olive oil.
Heat the olive oil in a large, deep skillet over medium-high heat. Add the mushrooms, onions, and kosher salt. Cook, stirring occasionally, until the mushrooms have released their liquid and the liquids have mostly evaporated, about 10 minutes.
Add the garlic, black pepper, and thyme. Cook, stirring, for one more minute. Remove from heat.
Transfer the mixture to the prepared baking dish. Sprinkle it with the shredded cheese.
Bake the casserole until hot and bubbly, about 15 minutes. Sprinkle with parsley and serve.
Video
Notes
If your casserole dish is broiler-safe, instead of baking, you can simply broil the casserole for 2-3 minutes in the middle of the oven until the cheese is melted. You don't want to get too close to the heating element and risk burning the casserole.
A good way to vary this recipe is to use different cheeses, such as cheddar, Gouda, or provolone.
I use a lot of mushrooms - 32 ounces. But keep in mind that mushrooms lose significant volume after they are cooked. Once cooked, they fit nicely in a 2-quart casserole dish.
I like to use brown mushrooms because they make the casserole look more presentable than white mushrooms. So, I typically use baby Bella or crimini mushrooms.
Once the leftovers are cool, transfer them with a slotted spoon to an airtight container and keep them in the fridge for up to 4 days. Reheat them in the microwave at 50% power.