Melt 2 Tablespoons of butter in a large pot over medium heat. Once melted, add the onions and cook until slightly softened, about 4 minutes. Add the sliced mushrooms and cook until your desired color and texture.
Remove the onions and mushrooms to a small bowl. Place the remaining butter in the pot. In another pot prepare the pasta according to package directions, boil until al dente.
Whisk the flour into the hot melted butter mixture to form a roux, then whisk in the milk. Season with salt, pepper and thyme and cook for 8 minutes until thickened.
Stir in the chicken broth, pasta, green peas and cooked ham and cook until ham is warmed through. Set oven to broil. Pour the pasta mixture into an 8" x 8" casserole dish and sprinkle the grated Parmesan cheese overtop. (French's fried onions on top is great too)
Place the casserole dish in the oven and broil until cheese is golden and melted. (this step is optional)