Preheat the oven to 200°C/400°F/gas 6.
Heat a lug of olive oil in a large pan over a medium heat.
Add the onions, garlic, carrots and celery and cook gently for about 10 minutes, until softened.
Add the lentils, tomatoes, tomato purée, stock, chilli powder and thyme. Stir well and season.
Bring to the boil, then reduce the heat and simmer for 40–50 minutes, until the lentils are softened. You may need to add more stock (or boiling water) throughout cooking if all the liquid is absorbed before the lentils are cooked.
Meanwhile, make the mash. Place the potatoes in a large saucepan with just enough cold water to cover them. Add a pinch of salt and bring to the boil. Boil for 15–20 minutes, until the potatoes are tender and easily broken with a fork. Drain them in a colander and leave for 2–3 minutes, until the steam has evaporated.
Always drain potatoes really well or you’ll end up with watery mash.
Put the drained potatoes back into the dry saucepan and mash thoroughly with a potato masher. The harder you work the mash, the fluffier it will become.
Once the lumps are gone, add the butter and mash again. Add the milk, stirring until combined. Season to taste.
Once the lentils are cooked, remove the sprig of thyme and pour the mixture into a deep ovenproof dish, leaving room for the mash topping.
Arrange the mash evenly on top of the lentil mixture and bake the pie in the oven for 20 minutes or until nicely browned.
Serve on warmed plates, with a green salad on the side.