1. In a 10- to 12-inch frying pan, combine oil, onion, garlic, and mushrooms. Stir often over high heat until onion is limp, 3 to 4 minutes.
2. Add ham and stir often until mushrooms are lightly browned, about 5 minutes longer.
3. Add tomato sauce and pesto to mushroom mixture. Turn heat down to low.
4. Squeeze liquid from spinach. Add spinach to pan and heat until simmering.
5. Meanwhile, cook vermicelli in about 3 quarts boiling water until just tender to bite, 7 to 9 minutes. Drain and keep warm.
6. Mix yogurt and cornstarch. Stir into sauce, then stir over high heat until bubbling, about 3 minutes.
7. Pour sauce over pasta. Mix to blend. Add salt and pepper to taste.