Put the flour, butter, egg and egg yolk in a food processor and blend until a soft dough is formed. If the pastry will not come together, add a drop of cold water. Take the dough out of the processor and knead lightly until smooth. Place it in a freezer bag or wrap in clingfilm and chill in the refrigerator for at least 30 minutes.
Roll the pastry out on a well-floured work surface until it is about 3 mm (⅛ inch) thick and use to line a 23 cm (9 inch) fluted tart tin. Trim off the excess pastry. Chill the lined tart tin for 1 hour.
Line the tart with a piece of nonstick baking paper and cover with baking beans, then place in a preheated oven, 180°C (350°F), Gas Mark 4, for 10–12 minutes until lightly golden. Remove from the oven and take away the baking paper and beans. Place back in the oven for a further 2 minutes to dry out the base of the pastry case. Remove from the oven once more and set aside. Leave the oven on.
Meanwhile, heat the butter and oil in a frying pan, add the onions and thyme and fry over a low heat for about 20 minutes until the onions are golden brown.
Remove the thyme and spread the onions over the tart base. Beat together the eggs, milk and cream in a bowl, season with salt and pepper and pour over the onions. Cook in the oven for 10 minutes until slightly risen and starting to set. Remove from the oven and arrange the tomatoes and anchovies on top of the tart, then return it to the oven for a further 10–15 minutes until the filling has set completely. Cool for 5 minutes before serving.