In a large skillet over medium-high, start browning the ground beef. When it is about one-third of the way browned, add the onion, carrots, and celery. Continue cooking until the onions and celery are soft. Reduce the heat to medium-low and add the garlic, cooking for 1 minute while stirring.
Sprinkle in the flour and cook for about 2 minutes while stirring. Slowly stir in the beef broth, the red wine, if using, Worcestershire Sauce, fresh thyme, and bay leaves.
Simmer for 15-20 minutes or until thickened. Add the frozen peas and remove the bay leaves. Spoon the mixture into the prepared casserole dish and let it cool. For best results, chill it for at least 30 minutes to keep the layers separated.
Meanwhile, preheat the oven to 375 degrees, put the potato cubes in a large pot of lightly salted cold water, and bring the pot to a boil. Cook the potatoes for about 15-20 minutes or until fork tender. Drain them well and add the butter and warm milk. Cover and let the butter melt.
Mash the potatoes until they are lump-free and smooth. Stir in the cheddar cheese and season with salt and pepper to taste. Spoon the potatoes onto the chilled meat mixture and spread evenly. Use the tines of a fork to scratch the potato surface for slightly crispy edges.
Sprinkle the top with chopped fresh thyme and bake for 25-30 minutes or until golden on top and bubbly on the edges. Let the dish cool for 5 minutes before serving.