Roughly chop the pastry into pieces and place in a food processor. Add the parmesan and the leaves from 3 thyme sprigs. Pulse until combined. Bring back into a ball, using your hands.
On a lightly floured surface, roll out the pastry to ½cm thickness. Line a 23cm tart tin with the pastry. Trim the edges, leaving about 1cm of pastry overhanging. Chill in the fridge for 20-25 minutes.
Preheat the oven to 190°C, 170°C fan, gas 5. Line the pastry case with greaseproof paper and add baking beans. Place on a baking tray and cook in the oven for 15-20 minutes until the sides are set and golden. Remove the beans then continue to cook for 10-15 minutes, until the base is crisp. Turn the oven down to 180°C, 160°C fan, gas 4.
Meanwhile, heat the oil in a large pan and cook the onion, courgette and remaining thyme over a medium-low heat for 10-15 minutes. Stir in the garlic for the last 2 minutes of cooking time.
In a bowl, beat the eggs, milk, crème fraîche and cheese together. Season with freshly ground black pepper. Spoon the courgette mixture into the base of the tart. Pour the egg mixture on top and bake in the oven for 40-45 minutes until just set. Remove and leave to one side for 10 minutes before serving in slices with the salad.