Bring a pot of salted water to a boil and cook spaghetti according to package directions. Drain, reserving 1 tablespoon cooking water, and set aside.
While pasta cooks, heat olive oil in a skillet over medium high heat. Add onion and garlic and saute until the onions are translucent, about 3-4 minutes. Add white wine and simmer until the alcohol evaporates, about 2 minutes. Stir in reserved pasta cooking water, shrimp, and half-and-half and cook until shrimp are heated through, 2-3 minutes. Add spaghetti and stir to coat. Sprinkle with parmesan cheese, parsley, and black pepper.