The comment that made me decide to use med-to-good quality wine for cooking came from Julia Child's THE ART OF FRENCH COOKING. She mentions how when you cook with alcohol, you basically burn out the alcohol so the flavor that is left in the dish is the taste of the wine sans alcohol. Therefore, you probably want to get something that you'd be okay with drinking. My rule changes depending on whether I'm using red or white wine. On one of the COOK'S ILLUSTRATED books (from America's Test Kitchen), they have an entire section discussing using wine for cooking. They tested a variety of red wines, ranging from cheap to expensive, and they said that for cooking, they saw a huge improvement between the $5 reds and the $10 reds; however, they saw little difference between $10 and the more expensive kinds. For whites, I'm more willing to use less expensive wines.
I also think you should choose depending on the dish. If you're making coq au vin, where the wine is a huge component, you probably want to pay extra attention to the quality of the wine. If you're making something where the wine isn't the star, you can probably adjust accordingly. I will say, cooking wine is pretty gross and I wouldn't recommend it.
"Some people can thrive and bloom living life in a living room, that's perfect for some people of one hundred and five. But I at least gotta try, when I think of all the sights that I gotta see, all the places I gotta play, all the things that I gotta be at"