Well...
When Trump was running all the scandals were on the right.
Right now:
1. Left wing sex scandals (not specific to Virginia but undermines the "Democrats as defenders of women" narrative).
2. Jobs is the number #1 issue in the campaign.
3. More than 60% upset about the statue thing.
4. Gillespie has a strong ground game and campaigns in areas where he isn't the favorite.
Further Virgina is only slightly blue. And there is a large "southern" contingent that don't appreciate the culture wars.
There are a number of intangibles (including that an off-year electorate tends to run older) that work in Gillespie's favor.
Gillespie is a lot closer than he should be, because his opponent has to run left of the center in Virgina.
https://www.theatlantic.com/politics/archive/2017/10/virginia-governor-gillespie-northam/543984/
Republican nominee Ed Gillespie, a party operative and former lobbyist once considered a relative centrist, has built his campaign around a succession of racially infused attacks against his Democratic opponent, Ralph Northam, the current lieutenant governor. Gillespie has besieged Northam on his opposition to Confederate monuments, and on his support for so-called sanctuary cities, which don’t fully cooperate with federal immigration enforcement and which Gillespie alleges protect the Central American gang MS-13.
Trump won because Americans were pissed off. Northam supports some of the issues that piss them off.
Gillespie gained moment by going right, which in this case means he embraced the majority opinion. In fact there are articles that call him racist.
We'll see. If Gillespie wins, a pro-Trump, pro-culture message will become popular in other Republican campaigns.