Heat olive oil in a skillet over medium heat. Add leeks, garlic, and ham and cook until leeks are tender, about 5 minutes. Add thyme, flour, wine, and broth and cook until sauce thickens, about 3 minutes.
Add peas and transfer mixture to a 9x13 inch baking dish.
In a large pot, bring potatoes to a boil. Reduce heat and simmer until potatoes are tender, about 15 minutes. Drain and mash with butter and milk. Season with salt and pepper.
Spread mashed potatoes over the leek and ham mixture in the baking dish.
Bake in preheated oven for 25 minutes, or until potatoes are lightly browned.