Preheat the oven to 180c/160c fan. Line a baking sheet with non-stick baking parchment.
First, make the meatloaf. Mix together the mushrooms and beef in a large bowl.
Heat the oil in a deep frying pan. Add the onion, celery and carrot. Fry for 2 to 3 minutes until soft. Mix in the thyme and garlic and cook for a further minute. Leave to cool slightly.
Add the egg, Worcestershire sauce, salt, pepper and cooled vegetable mix to the beef and stir thoroughly. Shape the mixture into a thin loaf and place on a baking sheet. Bake in the oven for 45 minutes until cooked through. Leave until cold.
Meanwhile make the topping. Melt the butter in a frying pan and add the mushrooms. Cook, stirring frequently over a low heat, until the mushrooms are soft, and all the liquid has evaporated. The mixture needs to be really dry – this will take around 10 minutes. Stir in the thyme and season. Leave to cool.
Turn the oven up to 200c/180c fan. Prepare another lined baking sheet. Lay out the pastry and spread some of the mushroom mixture into the middle, about the same area as the meatloaf. Place the meatloaf on top of this and then use the remaining mushroom mixture to completely cover it.
Cut slits along both edges of the pastry around the meatloaf, descending in opposite directions, about 1.5cm apart. Starting from the top, wrap the pastry around the loaf, trimming off any excess and then fold over the pastry strip into a lattice. Wrap the other end of the pastry under the last strips and again, trim away any excess.
Transfer the loaf onto the baking sheet. Brush generously with beaten egg and bake in the oven for 20 minutes, or until crisp and golden. Serve hot or cold.