In results likely to shake up South Carolina's political landscape and grab national attention, Democrat Joe Cunningham won the state's coastal seat in Congress.
The outcome, which was not decided until 2 a.m. Wednesday, is a rebuke for both President Donald Trump and Republicans who had held the seat since the Reagan era.
Additionally, Republican hopeful Katie Arrington had been widely favored to win the seat and keep the district in GOP hands but fell victim to the assumption that being a conservative was enough in a district drawn with a built-in red base.
Arrington spent much of the final days trying to nationalize the race and playing up her support for Trump, his border wall and a tougher stance on immigration, something Cunningham avoided.
"We just pulled off a miracle," Cunningham spokesman Tyler Jones said after news outlets called the race in Cunningham's favor.
Unofficial results gave Cunningham 50.56 percent of the vote to Arrington's 49.26 percent, with 99 percent of precincts reporting.
The vote difference was 3,509. The percentage margin was 1.3 percent. Any finish with a result under 1 percent difference triggers an automatic recount in South Carolina.
The results will be certified Friday and it would be up to the state Election Commission to determine if a recount is needed.
Most of Cunningham's cushion was attributed to returns from populous Charleston County, the only blue county of the five in the coastal 1st Congressional District.
With the outcome up in the air, both sides closed down their victory celebrations before 1 a.m. and sent their supporters home to await the final outcome. It was decided when Beaufort's count finally came in during the morning hours.
With the seat going blue, it creates a huge shock to state politics. The last time Democrats flipped a House seat in South Carolina was 1986. The 1st District was also drawn to favor Republicans. It includes all or sections of Charleston, Berkeley, Dorchester, Beaufort and Colleton counties.
"This demonstrates that the right candidate at the right time can win in a red district in South Carolina," said Jordan Ragusa, a political science professor at the College of Charleston.
Cunningham, a West Ashley lawyer and political novice, was considered a long shot when he announced his first ever bid for public office last year. But an Arrington victory would have been historic as well, potentially making her the first Republican woman in South Carolina elected to the U.S. House of Representatives.
The last time a South Carolina woman was elected to Congress was in 1986 when Spartanburg Democrat Liz Patterson won her seat in the Upstate's 4th Congressional District.
Arrington, a one-term state representative from Summerville, won the GOP nomination earlier this summer by defeating incumbent Mark Sanford in the June Republican primary. For her race then and now, she closely associated herself as a Trump supporter.
In the final 24 hours leading up to the vote, Arrington's Twitter account was sharing news stories about the thousands of Central American migrants traveling in a caravan toward the U.S.-Mexico border.
The caravan has become a talking point used by GOP candidates like Arrington to voice their support for Trump's proposal to build a wall at the border, along with tighter immigration.
By contrast, Cunningham had tried to trip up Arrington with a profoundly local issue — the opening of permits for offshore oil drilling in the Atlantic. Potentially allowing oil and gas exploration is a Trump administration policy that united coastal voters of both parties in opposition, and Arrington initially said she supported the president's plan to open leasing in federal waters.
Her murky initial position also cost her public support from three coastal mayors who identify as Republicans.
Though she spent much of the rest of the campaign softening her stance and characterizing her opponent as a one-issue candidate, it was not enough to claim the seat.
Cunningham spent election day bouncing between voting locations in West Ashley, Hilton Head and Mount Pleasant, greeting voters in line.
When one supporter in line at the Mount Pleasant National Guard Armory commented that he must be tired, Cunningham joked, "Just two and a half hours left, but who's counting?"
But he spent several more hours talking to voters, handing out snacks to people in line at St. Johns High School after the polls had technically closed. That location had people in line hours after voting officially ended, and the final voter tweeted that he had made it through just before 10 p.m.
Spirits remained high at Cunningham's party throughout the night, though results from Charleston County were slow to come in. Cunningham urged the crowd to be patient after he arrived at the American Theater in downtown Charleston around 11:20 p.m.
"The good news is, we are neck and neck in this race, and we are still going to win this thing. The bad news is, it's going to be a long night," he said.
An hour and a half later, most of the remaining ballots in the county were in, and Cunningham took on a more serious demeanor—briefly pacing in the back kitchen with his wife, Amanda. His lead had expanded further, and all that was left was the remaining vote in Beaufort County. The Beaufort vote wouldn't be enough to erase his advantage when it finally came, hours later.
As he walked the kitchen, head bowed, he looked as if the reality of winning the seat—and transforming a piece of South Carolina's political landscape—had, for the first time, fully sunk in.