Heat a splash of oil in the large skillet over medium heat. Add chopped onions and cook until translucent and fragrant, about 5 minutes, until they start to turn golden.
Add minced garlic and cook for another minute, until it releases a fragrant aroma and becomes slightly golden.
Stir in the ground beef, breaking it apart with your spoon, and cook until browned and cooked through, about 8 minutes. Season with salt, pepper, and a pinch of thyme if desired.
Add the leftover cooked vegetables to the skillet, stirring to combine. Cook for another 5 minutes until everything is heated through and slightly caramelized, then pour in the broth or gravy to moisten the mixture. Let it simmer gently while you prepare the potatoes.
Meanwhile, place the peeled and chopped potatoes into a saucepan and cover with salted water. Bring to a boil and cook until very tender, about 15 minutes.
Drain the potatoes well and transfer to a large bowl. Add butter and warm milk, then mash until smooth and fluffy. Taste and season with salt and pepper as needed.
Spoon the hot meat and vegetable mixture into your ovenproof dish, spreading it evenly with the back of your spoon.
Top the filling with the mashed potatoes, smoothing the surface evenly with a spatula. For extra flavor, sprinkle with grated cheddar cheese if using.
Bake in a preheated oven at 200°C (400°F) for 20-25 minutes, until the top is golden and bubbly. For a crispy crust, broil for an additional 2-3 minutes, watching carefully to prevent burning.
Remove from the oven and let rest for about 5 minutes to allow the layers to set. Slice into portions and serve hot, enjoying the warm, comforting layers of this resourceful dish.