Preheat your oven to 400 degrees 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.
If your casserole dish is broiler-safe, 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.