Preheat & Boil: Preheat your oven to 375°F (190°C). Bring a large pot of salted water to a boil. Cook the pasta to al dente (usually 1-2 minutes less than package instructions) as it will continue cooking in the oven. Drain and set aside.
Sauté Aromatics: In a large deep skillet or Dutch oven, melt the 4 tbsp butter over medium-high heat. Add the mushrooms and onions. Sauté for 6-8 minutes until the mushrooms are browned and moisture has evaporated. Add garlic and thyme; cook for 1 minute until fragrant.
Build the Roux: Sprinkle the flour over the vegetables and stir constantly for 2 minutes to cook out the raw flour taste. It will look pasty.
Deglaze & Thicken: Pour in the sherry/wine and scrape up any browned bits from the bottom of the pan. Slowly whisk in the chicken broth and half-and-half.
Simmer: Bring the mixture to a gentle bubble. Reduce heat to low and simmer for 3-4 minutes until thickened enough to coat the back of a spoon.
Melt & Mix: Remove pan from heat. Stir in the Swiss/Gruyère cheese, black pepper, and nutmeg until smooth. Fold in the cooked pasta, cubed ham, and peas. Taste and add salt if needed (ham is salty, so taste first!).
Top & Bake: Transfer the mixture to a 9x13 baking dish (or keep in the skillet if oven-safe). In a small bowl, mix Panko, Parmesan, melted butter, and parsley. Sprinkle evenly over the pasta.
Finish: Bake for 20–25 minutes until the sauce is bubbling around the edges and the topping is golden brown. Let rest for 5 minutes before serving.