Preheat the oven to 200°C, fan 180°C,gas 6. In a large frying pan, heat the oil, then add the onion and cook for 5 minutes. Add the leeks, garlic and mushrooms and cook for a further 5 minutes.
Stir in the flour, half the thyme, the tomato purée and yeast extract. Cook for 2 minutes, then add the ale, stock and the lentils. Bring to the boil, then turn down the heat and simmer for 5 minutes. Transfer to a 1.5-litre baking dish.
Meanwhile, put the sweet potato in a large microwave-safe bowl with a couple of tablespoons of water. Cover with cling film and cook in the microwave on medium for 6-7 minutes until tender. Roughly mash and season with freshly ground black pepper, then spoon on top of the mushroom filling. Top with the grated Cheddar and remaining thyme and bake in the oven for 30 minutes, until golden.
Meanwhile, cook the beans in a pan of boiling water for 3-4 minutes. Drain and serve with the pie.