Boil the potatoes in lightly salted water until cooked, drain well and mash with two-thirds of the butter and the milk. Mix in the Cheddar cheese and season to taste.
Preheat the oven to 200°C. Melt the remaining butter in a frying pan, add the onions and cook on medium heat for 10 minutes. Stir in the thyme and sugar and continue to cook until golden and caramelised.
Spread half the mashed potato in the bottom of a pie dish or ovenproof dish. Spread the onions on top and cover with the remaining potato. Arrange the tomato slices on top and sprinkle with the breadcrumbs and Parmesan cheese. Bake in the centre of the oven for 30 minutes, or until golden brown and piping hot. Serve with a crisp green salad or cooked green vegetables.