Ed Gillespie in 2012 on “Face the Nation.” (CBS)

The Virginia gubernatorial primary on Tuesday delivered good news for Democrats and an ominous warning for the Trump-ized GOP. Democratic turnout was through the roof with more than 543,000 votes. GOP turnout was about 366,000. The more establishment Democrat, Lt. Gov. Ralph Northam, won by a much bigger margin (56 percent to 44 percent) than expected. Republican Ed Gillespie, who had led by double digits in polling, won by slightly more than 1 percent. (A margin of less than one percent would have triggered an automatic recount.) Gillespie’s opponent Corey Stewart, a demagogue on immigration who made an issue over taking down Confederate monuments, vastly over-performed in his primary, just as President Trump did in the 2016 campaign season. Gillespie, who vastly outspent his opponents, wound up with about 160,000 votes, almost 80,000 votes fewer than the loser in the Democratic primary.

It may be that in the age of Trump, the Republican Party risks shriveling or splintering outside deep-red strongholds. Moderate Republicans in Tuesday’s primary might well have crossed over (allowed in a state with no registration by party) to vote in the Democratic primary for Northam, thereby boosting his margin and gravely damaging Gillespie. If this becomes a pattern outside Virginia, the GOP will be in deep trouble in 2018 and beyond.

Rick Wilson, a GOP operative and high-profile #NeverTrumper, noted that Gillespie made a hard-right turn on immigration and even on Confederate monuments at the end. “Ed chased Trumpism, and Stewart was the real deal to Trumpers,” Wilson explained. “By doing that, even if Ed survives the vote (and possible recount) he’s going to have trouble winning in Northern Virginia now.” The latter has become the barrier to the GOP in Virginia statewide races. If it cannot make inroads into populous suburban counties with more moderates and college-educated voters, statewide races become unwinnable for Republicans. Wilson wisecracked that “‘the precious Confederacy!’ isn’t a winning message.”

Gillespie barely scraped by, but in sprinting to his right to beat Stewart, he risks doing much worse in Northern Virginia counties than he did in his surprisingly strong 2014 Senate race against Sen. Mark Warner (D-Va.). The loss of a chunk of voters in bigger population centers likely won’t be made up by downstate voters who picked Stewart in the primary, not believing that Gillespie was Trumpian enough.

Virginia may be an outlier — at least, that is what Republicans hope. If not, a significant party realignment may take shape in Georgia’s 6th Congressional District special election next week and in the 2018 House and Senate races. Moderates, women, college-educated voters and suburbanites could decide to exit the Trump GOP in droves. If the party is now the party of Confederate monuments and anti-immigrant hysteria, then it will become untenable for such former Republicans, an anathema to their sense of fairness, tolerance and rationality. They then may head for the Democratic Party. If they do, the GOP will be at risk in the sort of seats in which Trump vastly under-performed in comparison with Mitt Romney in 2012 and Sen. John McCain (R-Ariz.) in 2008.

Democrats will need to avoid going far left in order to benefit from GOP defections. They will also need a positive message that offers traditional Democrats and newly alienated Republicans an alternative to Trump-Stewart Republicans. They have time — and with a possible win next week in Georgia and in Virginia in November, they may get a shot in the arm from donors and newly recruited candidates anxious to compete against flagging Republicans. In short, Trump may do for Democrats what President Barack Obama did for Republicans — give them a new lease on life.