Heat the oven to 400°F and line a baking sheet with parchment paper. Unroll the puff pastry onto the sheet and lightly score a border around the edge.
Warm the olive oil in a large skillet over medium heat. Add the diced onion and cook until it softens, about 3 minutes.
Stir in the sliced mushrooms and cook until they release their liquid and start to brown, 6 to 8 minutes.
Add the minced garlic and thyme leaves. Cook for 1 minute more, then season with salt and pepper. Remove the skillet from the heat.
In a mixing bowl, whisk together the heavy cream, eggs, and Gruyere cheese. Fold the mushroom mixture into the bowl until evenly combined.
Spread the filling inside the scored border of the pastry. Bake for 20 to 25 minutes until the crust is golden and the center is set.
Let the tart cool for 5 minutes, then cut into squares. Top with fresh thyme sprigs before serving.