Projections from early exit polls have a well-deserved reputation for being dubious — just ask President John Kerry. But early Tuesday evening, they suggested a potentially shocking outcome in Virginia. Ed Gillespie, the Republican U.S. Senate candidate, was in an extremely close race against Democratic incumbent Mark Warner, who had led by about 9 percentage points in pre-election surveys. If the exit poll was even close to accurate, it was one of the early signs Republicans were due for a huge night.

Warner will probably survive his race, but not by much. As of Thursday afternoon, he led by about 17,000 votes — or 0.8 percentage points — and the few remaining areas yet to report their vote seemed slightly favorable to him. The exit polls got the race just right. The pre-election polls — in an election for which they had plenty of misses — did not.

If Gillespie had won the race — or if he eventually does — he’d be the most unlikely candidate to do so in a Senate or gubernatorial race since 1998, at least based on the final polls. (I’m limiting this analysis to races that had at least three polls released in the final 21 days of the campaign, according to the FiveThirtyEight polling database. Sparsely polled races, like the Maryland gubernatorial race this year, present a different problem.) In 1998, Democrat Ben Cayetano was re-elected as Hawaii’s governor despite trailing Republican Linda Lingle by 11 percentage points in pre-election surveys. That same year, Reform Party candidate Jesse Ventura won the Minnesota governorship despite being 9 points down.

So, we’re talking about a once-or-twice-a-decade error — the point on the probability distribution where an outcome goes from being impossible to merely improbable. (The FiveThirtyEight model listed Gillespie’s chances at 0.5 percent.) But there have been dozens and dozens of races where candidates led by a similar margin in the polls and never had to break a sweat.

Where the exceptions occur, the problems are sometimes easy to diagnose. Minnesota in 1998 was a three-way race — Ventura prevailed over Republican Norm Coleman and Democrat Hubert Humphrey III — and those are far more volatile than races where there are just two viable candidates on the ballot. Hawaii, meanwhile, has a long history of terrible polling, perhaps because of the state’s demographic makeup. Between 1998 and 2012, polls of gubernatorial and Senate elections there missed the final margin by an average of almost 12 points, the largest error of any state but Wyoming, according to the FiveThirtyEight database.

Virginia’s result is harder to explain. Since 1998, the average polling miss there in Senate and gubernatorial races had been about 4 percentage points — meaning polls there had been slightly more accurate than average. Nor have Virginia’s polls shown much long-term bias toward either Democrats or Republicans.

Did the “fundamentals” of the race favor Gillespie or at least project a photo finish? In some of the states the polls miscalled, the fundamentals — as FiveThirtyEight’s model evaluates them — pointed in the right direction. Our fundamentals calculation had Republican Thom Tillis of North Carolina slightly favored over the Democrat Kay Hagan, for instance, and Republican Pat Roberts heavily favored to hold his seat against independent Greg Orman.

But this wasn’t the case in Virginia. Our fundamentals calculation had Warner up 9 points — just where the polls had the race. Weighing in Gillespie’s favor was that Virginia is a purple state in a red-leaning national climate in a year where incumbents of all stripes were unpopular. But everything else favored Warner. He’d raised considerably more money than Gillespie and won overwhelmingly in 2008. Gillespie — while an experienced political hand as the former head of the Republican National Committee — had never run for public office before. Warner has a fairly moderate voting record that squares well with those of voters in Virginia.

The FiveThirtyEight fundamentals calculation does not consider a candidate’s favorability or approval ratings, but those looked good for Warner, too, having usually been in the range of 55 to 60 percent. More astoundingly, they were 56 percent among voters surveyed in Tuesday’s exit poll — the voters who nearly booted him out of office.

The Virginia result reminds me of two other cases — one where a heavily favored incumbent did lose and another where there was a near-miss.

The near-miss was in New York’s mayoral election in 2009. Incumbent Michael Bloomberg, up by about 15 points in the polls against Democrat Bill Thompson, instead won by just 4.

The loss is one I remember from my childhood: Republican John Engler defeated two-term incumbent James Blanchard in Michigan’s gubernatorial race in 1990. I wasn’t a polling geek back then, but I remember everyone being shocked by the outcome. Sure enough, the race soon became infamous among pollsters. Blanchard had led by 14 percentage points in the final Detroit News poll. The Detroit Free Press showed a closer race, with Blanchard up 4 points among likely voters. Even Engler’s internal polls had him slightly behind.

The races in Michigan, New York and Virginia have a few things in common:

Popular but longstanding incumbents. One of the odd things about New York’s race in 2009 was that Bloomberg, like Warner, had strong approval ratings even among the voters who nearly defeated him. The exit poll that year had Bloomberg with a 70 percent approval rating. But one-quarter of voters who approved of his performance voted for Thompson anyway.

Some of this may have been because Bloomberg encouraged a change to New York’s term-limit laws to allow himself to run again (voters changed them back a year after Bloomberg was re-elected). New Yorkers thought Bloomberg had done just fine, but they didn’t like how he’d changed the rules and were ready for a change.

Blanchard, likewise, had served two terms at the time of his defeat. The 1990 exit poll in Michigan did not ask about his approval rating, but there’s reason to think it would have been fairly high. Blanchard defeated Republican William Lucas by a record margin — 37 percentage points — in 1986 and was considered a potential vice-presidential candidate. A CBS News report from Sept. 10, 1990, described him as “the popular governor of Michigan.” Michigan’s unemployment rate had fallen considerably during Blanchard’s tenure, although it was rising again by 1990.

Warner is serving his first Senate term — but he’s a familiar face to Virginia voters, having been the state’s governor between 2002 and 2006. Warner’s 10 years in office is a lot of time by Virginia standards. Uniquely among the states, it limits governors to one consecutive term. And while John Warner served the state for 30 years, all the other senators it has elected since 1982 have served just one or two terms.

Low turnout. Another unusual facet of Virginia’s gubernatorial races is that they are held in odd-numbered years (2005, 2009, 2013) rather than in conjunction with federal races. That can contribute to middling turnout in midterm years even as Virginia’s turnout in presidential elections has been above-average.

Turnout in Virginia this year is projected to be 37 percent of the voting-eligible population — in line with the figure nationally in a year where turnout is down across the board. But this is low in comparison to other states to have held competitive Senate races, where turnout averaged about 44 percent instead. Virginia’s 2014 turnout was also well below its figure in 2006 (44 percent), when the state hosted a competitive Senate race between James Webb and incumbent George Allen. It’s even lower than 2010 (39 percent) when it had neither a Senate nor gubernatorial race.

The Michigan and New York elections were also characterized by low turnout. In 1990, just 39 percent of eligible voters cast ballots in Michigan; the midterm-year average in the state since the voting age was lowered has been about 44 percent.

About 1.2 million New Yorkers cast ballots in the 2009 mayoral election, slightly more than would four years later in the noncompetitive race between Bill de Blasio and Joe Lhota, but below the average of 1.4 million from 1981 through 2005.

So … turnout explains it all? It’s a big part of the story. As The Washington Post reports, the turnout drop-off was higher in Democratic-leaning counties. And pollsters may have had trouble modeling the Senate race in Virginia: There was no precedent from 2010, and they would have overestimated it if turnout had been pegged to 2006.

But a few things are still hard to reconcile. If turnout were the whole story, you’d expect substantial differences between the demographics in exit polls and pre-election surveys. Instead, they closely match one another.

The Christopher Newport University poll projected black turnout at 16 percent, for example, and the Roanoke College poll had it at 19 percent — compared to 19 percent in the exit poll. Partisan and age demographics were also similar.

And as I mentioned, Warner’s favorability rating was 56 percent even among voters on the exit poll. Candidates with those sorts of numbers don’t lose — or come so close to doing so — very often.

So, what explains the result? I don’t know, but I have a theory — one that ties the race together with the ones in New York and Michigan. It’s that some voters who would otherwise be inclined to vote for Warner went for Gillespie because they didn’t think Warner needed their vote.

That Warner and Bloomberg were quite popular among voters in the exit polls contributes to the theory. Some voters may have been perfectly willing to vote for them if they thought they’d needed to. But because they didn’t see the races as competitive, they felt free to use their vote in other ways. They might have voted for Gillespie as an expression of their overall dissatisfaction of the direction of the country, for instance, or Thompson as a protest against Bloomberg’s change to term-limit laws.

There may be a danger zone when a candidate leads by about 10 percentage points in the polls, as Warner and Blanchard did. That’s a big enough lead that the news media may not portray the race as competitive — Blanchard’s re-election was thought to be quite inevitable, for example, as was Bloomberg’s. Another example is Barack Obama’s lead of about 8 percentage points over Hillary Clinton in polls of the New Hampshire Democratic presidential primary in 2008. The media seemed to regard another win for Obama as a sure thing after his victory in the Iowa caucuses.

But a 10-point lead isn’t completely safe. If the polls were a bit wrong to begin with, and turnout is a bit lower than expected, and a few voters change their mind in the ballot booth, the leading candidate can lose. (A 15- or 20-point lead, by contrast, would probably hold up even in the event of a catastrophic polling error; the candidate will still win, just by less than expected.)

Was the media wrong to imply these races were done deals? In the case of New Hampshire, absolutely — polls of primaries are much less accurate than polls of general elections, and an 8-point lead is not all that safe.

In general elections, it’s trickier. For every case like Warner’s, where the outcome turns out to be close, there are dozens of false alarms. (This year, for example, Democrats Tom Udall of New Mexico, Cory Booker of New Jersey, Al Franken of Minnesota, Dick Durbin of Illinois and Gary Peters of Michigan won their elections with ease despite polling in the same range that Warner did.) And the media’s overall bias — it makes for better headlines and more suspense this way — is toward characterizing general election races as less certain than they sometimes are.

Here’s the thing: Surprises, by definition, come only when we don’t expect them. There are some cases where a 10-point lead might (correctly or not) still be viewed as indicating considerable uncertainty, such as because the margin in the race was once narrower or the polls have a history of problems in a state or there was some late-breaking news event. In that case, though, voters would be alert to the danger. They’d be more likely to go to the polls and cast their ballot as pollsters expected them to.

But every now and then, there’s a true surprise, and a heavily favored candidate gets Englered. It’s important for keeping incumbents honest — and pollsters, too.