In a large pan over low heat, melt the butter and add the onions. Cook until the onions are completely soft. Add the mushrooms and bring the heat up to medium. Cook for about 5 minutes more, until the onions are cooked through. Add the thyme, soured crème, and salt & pepper. Let cook for 5 minutes more, until the mixture has thickened slightly.Preheat the oven to 400F.Lay out one sheet of the puff pastry . Spread the mushrooms/onion mixture over top, keeping it away from a 2-3cm border around the edge. Using a pastry brush, brush some of the beaten egg around the border. Lay the second sheet of puff pastry over top of the first, and squeeze the border edge together to seal tightly, being careful not to leave any open edges where filling could escape.Brush the top of the puff pastry with the remainder of the beaten egg, then cut a few slits in the top of the pastry.Bake at 400F for 25 minutes, until the pastry has puffed up and becomes golden. Serve warm with tomato ketchup.