Heat the oil in a large frying pan and add the mushrooms and onions.Stir occasionally until the mushrooms and onions are nicely caramelised. Set to one side.
Add the egg to a mixing bowl and mix well with a fork. (Keep a tiny bit to one side for glazing the tart).Add the cream cheese to the beaten egg and mix well. Add the parmesan cheese and parsley. Mix well and season with salt and pepper.
Place the pastry sheet (should measure approx. 21cm x 21cm) on a lined baking sheet.
Spoon the mushroom mixture onto the pastry and spread out evenly - leaving a clean border about 3cm wide all the way round.Fold the border up and over the mushroom mixture to create a rim. Scatter the crumbled ricotta and thyme leaves over the top. Brush the pastry edges with the left over egg.
Place in the oven for 15 minutes until nicely golden brown.