Immigration was a major factor in Virginia.
As for West Virginia, the situation is a little more complex:
-First, social issues rising up.
-Second, Al Gore's environmentalism (and the subsequent growth of this cause in the Democratic Party).
-Third, race. Hate to say this, but this seems to be a factor here.
I contest this. Obama and Kerry performed nearly the same in the state. Maybe the southern part of the state voted against him more because of his unapologetic environmental positions which called for heavy regulation on coal (cap and trade) and promoting "green energy", the emphasis was probably the greatest since any president. Many felt like he couldn't care less about their jobs. The Democrats still had a grip on the state level, but the presidential trend for the Republicans had been there for a while too (and this had to do with the urban rural divide and "progressive" wing of the Democratic party gaining strength). The truth is, the places that would vote on race the most are still where you'd stereo-typically think, the rural white areas of the deep south.