Ever since democrats adopted environmentalism and carbon reduction as a platform back in 2000 to convince nader voters to come back. West Virginia hasn't voted democrat since.
http://www.cbsnews.com/campaign2000results/state/poll_wvop-.htmlUnion members which were mostly that of the coal workers, went from strongly democrat for many generations, to 50/50 between Gore and Bush and have voted more and more republican.
Meanwhile in Virginia. There was a military personal/defense contracting jobs boom in Virginia during the Iraq war which was paid by the government. That many were thankful for, which was why counties like Loudon, Prince William county. And in Hampton roads, Suffolk, Chesapeake county. Went for Bush again in 2004. While a lot of states were not doing well in the early-mid 2000's. Virginia was an exception since those jobs and the runoff demand created by those jobs allowed the state to rebound. So by 2008 and 2012, once republicans rediscovered their fondness for reducing government spending. A lot of people who were employed because of the war and didn't want to see their jobs gone, quickly switched to the democrats.
Also add that with the huge increase in turnout by blacks and hispanics in the state. Virginia switched.