Donald Trump’s surprise victory wasn’t Tuesday’s only electoral shock.

Two of Georgia's most populous—and previously reddest—metro Atlanta counties voted for a democratic presidential candidate for the first time in a generation.

Some observers say demographic trends bringing minorities and transplants to the Atlanta suburbs have made those areas increasingly competitive for Democrats. This shift, compounded by Trump’s polarizing campaign, helped Hillary Clinton win both Cobb and Gwinnett counties.

Late returns in these counties and crucial Democratic strongholds in and around Atlanta helped keep Georgia in the ‘undecided’ column late into election night, surprising many who thought the state was safely Republican.

"There's no question, I mean, Hillary Clinton got more votes in Cobb County for Heaven's sake—that's huge," said Kerwin Swint, chair of the Political Science Department at Kennesaw State University. "It's becoming a multi-ethnic, multi-dimensional metro area in counties that before were reliably white, upper middle class."

Although Trump triumphed in Georgia, Swint said the state could turn reliably purple in the next five to ten years.

“It may be inevitable that Georgia will become a purple state, but that’s assuming a couple of very significant things,” Swint said. “It’s assuming that the population changes continue as they have been for the last ten years, and we have the increases in minority voters in particular, but it also assumes that party loyalties stay the same.”

University of Georgia political scientist Charles Bullock said he expects that after some back and forth over the next few elections, Democrats will start winning metro Atlanta by larger margins. This could have implications for the General Assembly and local races.

“They could be consistently Democratic, even in the midterms,” Bullock said. “It’s not going to stop at the top (of the ticket).”

Not everyone agreed that the partisan tide is turning in metro Atlanta.

Rose Wing, chair of the Cobb County GOP, said Trump’s unique candidacy may have temporarily discouraged some Republican voters. His comments about women, in particular, are thought to have hurt him.

“Cobb proved itself as a Republican stronghold,” said Wing, pointing to local and state-level Republican victories. “Those who chose to vote differently on that particular candidate will come back around.”

Wing said demographic shifts were not a threat to the Republican Party, which was, in fact, poised to attract minorities and other new voters.

Clinton beat Trump by a slim but notable margin of 6,800 votes in Cobb, capturing 49 percent of the vote compared to Trump's 47 percent. Libertarian candidate Gary Johnson won 4 percent of ballots cast.

Democratic State Senate candidate Jaha Howard also won the Cobb vote, boosting him to within striking distance of incumbent Republican Hunter Hill, who ultimately retained his seat. The sixth district straddles Cobb and Fulton.

In Gwinnett, Hillary Clinton won 51 percent of the vote to Donald Trump’s 45 percent. It’s the first time a Democratic presidential candidate has won Gwinnett since Jimmy Carter in 1976.

Democrats also picked up a state House of Representatives seat in Gwinnett. Democrat Samuel Park defeated incumbent Republican Rep. Valerie Clark in District 101. Their hopes of winning additional down-ballot seats were dashed, however, with Republicans maintaining their lock on the Gwinnett County Board of Commissioners.

Jim Shealey, chairman of the Gwinnett County Democratic Party, said he was proud to see the party’s work for Clinton pay off, even though it did not translate into victories down the ballot. Shealey said Democrats have shown they’re a real power in Gwinnett – something he said will benefit residents in the long run.

“We need balance between Republicans and Democrats,” he said. “We need balance as far as diversity is concerned.”

Even conservative Henry County appears to be inching left.

Two years ago, Henry voters supported Democratic gubernatorial candidate Jason Carter – the first time the county had favored a Democrat for governor since 1990. On Tuesday, they gave Clinton 51 percent of the vote.

With winners and losers separated by just a few thousand votes, every ballot counts. In Cobb, voter turnout was at 76 percent; in Gwinnett, it was 77 percent.

Kathryn Dowdy of Lilburn said she voted for Trump, even though he was not her first choice as a Republican.

“I did not want Hillary Clinton to be president,” Dowdy said. “She’s a very dangerous person.”

Kennesaw resident Jacqulyn Linthecome said she was supporting Clinton because she approved of her policies and considered Trump a “clown” and a “joke.”

“I don’t think it’s about being a woman voter, I think it’s about being a human being,” she said. “Just like I didn’t think being African American made a difference with Barack Obama.”

For others, ethnicity or communal identity was a central motivator. Voter registration among Hispanics in Georgia surged after Trump made disparaging comments about Mexicans.

Carlos Garcia heads the Pro-Immigrant Alliance of Cobb County. He said he believes the Hispanic vote helped defeat Trump in Cobb, a small bright spot in an otherwise bleak electoral map for his organization.

“My phone has not stopped ringing from people panicking about what Donald Trump might do,” Garcia said. “It was hard to believe for a lot of minority voters that Donald Trump won.”

Garcia said he was waiting for the dust to settle, hoping that Trump’s hard-line stance on immigration was just tough talk for the election.

—Staff writer Tammy Joyner contributed to this article.