Add the black beans, walnuts and mushrooms to a food processor, and blitz briefly to give a coarse mince-like texture. Don't allow the mixture to become completely smooth - you may need to scrape down the sides a couple of times to help it blitz evenly.
Heat the oil in a large, deep frying pan, and add the onion, garlic and carrot. Cook over a medium heat for 5 minutes, until the onion is soft and translucent. Add the bean mince, and cook for a few more minutes, stirring regularly, until the mixture is soft and dark in colour.
Add the hot vegetable stock, tomato puree, gravy granules, dried thyme, and plenty of black pepper. Mix thoroughly to combine, until the gravy granules have completely dissolved - they will thicken up the liquid. Bring to a gentle simmer, and allow to cook for a further 10 minutes or so, until the carrot is soft.
Add the sweetcorn and frozen peas, and mix to combine. Cook for a few more minutes until the peas are hot. If the mixture is too thick for your liking, add a dash more water - if too thin, add a few more gravy granules.
Serve hot with mashed potato, if desired.