01 - In a large bowl, whisk together flour and salt. Add cold butter and cut in using a pastry cutter or fingertips until mixture resembles coarse crumbs. Gradually add ice water until dough just comes together. Shape into a disk, wrap, and chill for at least 30 minutes.
02 - Heat olive oil and butter in a large skillet over medium heat. Add onions and cook, stirring frequently, until soft and golden brown, about 12 minutes. Stir in garlic and cook for 1 minute. Add mushrooms, thyme, salt, and pepper; cook until mushrooms soften and moisture evaporates, approximately 8 to 10 minutes. Remove from heat and let cool slightly.
03 - Preheat oven to 400°F and line a baking sheet with parchment paper.
04 - On a lightly floured surface, roll chilled pastry into a 12-inch circle. Transfer to the prepared baking sheet.
05 - Spread mushroom and onion mixture over the center of the dough, leaving a 2-inch border clear. Sprinkle with Gruyère cheese and parsley if desired.
06 - Fold the pastry edges over the filling, pleating as necessary to contain the filling, leaving the center exposed. Brush the pastry border with the egg wash evenly.
07 - Bake for 30 to 35 minutes, or until the crust is golden and crisp. Remove from oven and let rest for 5 minutes before slicing.