Heat olive oil in a large, deep, oven-safe skillet over medium-high heat. Add the onion and mushrooms and cook, stirring occasionally, until the onion softens, about 4-5 minutes.
Stir in the garlic and diced ham. Cook for another 2 minutes until the ham is lightly browned.
Pour in the chicken broth and half-and-half. Add the salt, pepper, thyme, and parsley, and stir to combine. Bring the mixture to a boil.
Break the spaghetti in half and add it to the skillet. Stir well to submerge the pasta. Reduce the heat to maintain a steady simmer. Cook, stirring often, for 8-10 minutes, or until the spaghetti is almost al dente. The sauce will thicken as the pasta cooks.
Turn on your oven's broiler. Make sure an oven rack is positioned about 6 inches from the heat source.
Remove the skillet from the heat. Stir in the frozen peas, mozzarella, and Parmesan cheese until the cheese is mostly melted and combined.
Sprinkle the panko breadcrumbs evenly over the top of the pasta.
Place the skillet under the broiler for 2-4 minutes. Watch it closely until the breadcrumbs are golden brown and crisp.
Let the dish rest for a few minutes before serving.