Pulse the flour, salt, and cheese together in a food processor.
Add the butter and pulse about 10 times until the mixture resembles a course cornmeal.
Add the egg yolk and pulse 2 to 3 times more.
Drizzle in 1/4 cup of ice water and pulse until the dough just comes together. Take the top off the food processor and pinch the dough. If it sticks together, then it’s ready. If it seems very dry, add the additional water 1 tablespoon at a time, checking the consistency after each addition.
Place a sheet of plastic wrap on the counter, shape the dough into a disk and wrap in the plastic wrap. Refrigerate for at least an hour or up to two days.
For the filling, wash and slice the mushrooms. Slice the onion. Mince the thyme.
Heat a large nonstick skillet over medium heat. Add the butter.
When melted, add the onion and cook for about 5 minutes.
Then add the mushrooms. Cook until just softened, about 5 minutes.
Add the salt, heavy cream, and thyme and cook for 4-8 more minutes until most of the water from the mushrooms has cooked off. Stir in about 1/3 of the cheese then set the skillet aside to cool.
Preheat the oven to 400 degrees F.
Roll the dough on a lightly floured surface into an 11-12-inch circle. Transfer the dough to a foil-lined baking sheet sprayed with cooking spray.
Sprinkle another 1/3 of the cheese on the dough, leaving about 2 inches open at the edge.
Spoon the mushroom filling in the center of the dough and spread out, leaving about 2 inches at the edge. Fold the dough over the edge of the filling.
Bake until the crust is golden brown, about 25-35 minutes. Scatter the remaining gruyere over the filling and bake until melted, about 5 minutes more.
Allow to cool for a few minutes then cut into wedges and serve.