Wikipedia has a nice link explaining a study in which real and artificial vanilla are compared:
It explains why and where it is possible to substitute one for another without losing flavor.
The gist of it is that real vanilla has a lot of flavor notes apart from vanillin, but these begin to bake off at around 280-300 degrees. So cookies with artificial vanilla tasted better than with real vanilla whereas cakes (which rarely exceed 210 degrees) ranked better with real vanilla, as did other uncooked or cold items.
The article also deals with the amount of alcohol present in pure vanilla extract and in artificial vanilla, and explains how that affects flavor.
Based on that, I would suggest artificial vanilla for baking/cooking at high temperatures and real vanilla otherwise.