Preheat the oven to 200C/390F/Gas 6.
For the hotpot, grease the insides of a medium ovenproof dish with a little of the butter, then place a layer of corned beef into the bottom. Seasoning with salt and freshly ground black pepper between each layer, top with a layer of onions, sprinkle over the thyme and cover with a layer of potatoes. Repeat the layers, finishing with the potatoes on top.
Pour the stock over the top, then dot with the remaining butter. Cover the dish with aluminium foil and place into the oven to bake for one hour, or until the potatoes are just tender. Remove the foil and return to the oven to cook for 15 minutes, or until golden-brown on top.
For the beans, bring a pan of salted water to the boil, add the beans and cook for 2-3 minutes, or until tender.
Melt the butter in a frying pan, then add the shallots and fry for 1-2 minutes, or until softened. Add the cooked beans and fry for a further minute, then season with salt and freshly ground black pepper. Add the parsley and toss well to coat.
To serve, spoon the corned beef hotpot onto a serving plate and arrange the beans alongside.