Cook pasta according to package directions, preferably al dente (firm to the bite). Drain; rinse with cold water and drain again.
In a large saucepan melt butter. Add onions and garlic. Cover and cook about 5 minutes or until onions are tender; stirring occasionally.
Stir in flour, thyme and pepper. Add half-and-half and the chicken broth all at once. Cook and stir until thickened and bubbly; cook and stir for 1 minute more. Stir in pasta, ham, and spinach. Spoon mixture into a greased 3-quart casserole dish.
Cover and bake in a 350*F (175*C) oven for 30 to 35 minutes or until heated through. Let stand 5 minutes. Stir gently to distribute cream sauce just before serving. Pass the Parmesan cheese to sprinkle on individual servings, if desired.