Set a skillet over medium heat and add the olive oil. Cook the onion for about 3 minutes to soften it.
Stir in the mushrooms. Sauté for approximately 5 minutes, mixing occasionally, until tender and no excess moisture remains.
Add the salt and black pepper. Take the skillet off the heat and leave the filling to cool slightly.
Preheat your oven to 375°F (190°C).
Dust the work surface with flour. Gently roll the pastry sheet to flatten its creases, then cut it into small squares or rounds.
Arrange the pastry on a parchment-covered baking sheet. Spread the cream cheese over the portions and divide the mushroom filling between them.
Gently press the pastry edges with a fork. Refrigerate for 10 minutes if desired.
Bake for 15–20 minutes, inspecting at 15 minutes and extending the baking time one minute at a time as needed. The finished pastry should be golden and crisp.
Cool briefly and scatter the grated Parmesan over the tartlets before serving.