Rub the butter into the flour and salt until it resembles breadcrumbs, add the water and bring it together into a dough. Roll out and line a 20 cm loose-bottomed tart or pie tin, then chill for 20 minutes.
Boil the potatoes for 12 to 15 minutes until tender, then drain well and leave them to steam dry in the colander.
Meanwhile, soften the onions and garlic in a little oil over a low heat for 10 minutes until sweet and just golden at the edges.
Blind bake the case at 200C (180C fan) for 15 minutes with baking paper and baking beans, then 5 minutes more without.
Mash the potatoes roughly, then stir through the onions, two-thirds of the cheese, the mustard, the milk and the thyme. Season generously with salt and pepper.
Pile the filling into the case, level the top and scatter over the remaining cheese. Bake for 20 minutes until golden. Rest for 10 minutes before slicing.