The hors d’ouevres were served, the mood lighting was set, the cash bar was open and the guests were trickling in. The question that lingered inside both the Society Room, an event space in Hartford, and the Old Greenwich Hyatt Regency Ballroom, was which party would become a celebration of the future, and which would turn into a wake for a stalled political career.

Supporters of incumbent Gov. Dannel Malloy filled the Society Room as they had on Election Day in 2010. Meanwhile, Republican challenger Tom Foley chose to end the night in Greenwich, his hometown. Both candidates spent the day riding from one polling place to another to rally voters and volunteers. While Malloy continued get-out-the-vote efforts into late evening, Foley returned home in the early afternoon and relaxed with his family while preparing his speech for the evening’s gathering.

Throughout the night, most attendees at both camps declared themselves optimistic, even as results essentially showed a dead heat, with Malloy’s lead margin dwindling to seven votes close to midnight. Malloy’s guests included Connecticut Democratic Party officials, long-time party activists, employees on other Democratic campaigns and union members who campaigned heavily for the governor. Many had to leave well before Malloy arrived. Foley invited campaign volunteers, friends and prominent state Republicans including state Senate Minority Leader John McKinney, whom he defeated in the Republican primary.

“I think that the extra momentum for Tom Foley in the last week is going to be the difference,” McKinney said at 9 p.m. “I think we’re going to be here for a very long night, but I also think we’re going to end up with a very close victory for Tom Foley.”

The crowd of Foley supporters, who observed state results on one projection screen and national results on the other, cheered and clapped at around 10 p.m. when the numbers indicated for the first time that evening that, with 50 percent of the vote, Foley had edged a 1 percent lead over Malloy’s 49 percent.

When Foley took the lead, Connecticut Republican Party Communications Director Zak Sanders said that although the race was still too close to call, he was hopeful that a Foley victory would be declared before the night was over.

“We saw a great response out there,” Foley campaign spokesman Mark McNulty said. “A lot of Democrats were voting for Tom, a lot of Republicans were voting for Tom and a lot of Independents were voting for Tom.”

The closeness of the race practically guaranteed that party attendees would be waiting for hours to find out whether they were drinking to celebrate or to numb the pain of loss.

He and several of his co-workers were the first people to arrive at the governor’s party, lining up outside the door shortly before the 8 p.m. start time.

To Alonzo, the scene inside the Society Room was a familiar one. He and other union members and Democrats had filled the space in 2010. That, too, had been a long night, ultimately ending without a clear victory for either side. Foley did not concede until six days after Election Day.

After that experience, Alonzo, his colleagues and the other party attendees were not discouraged by initially unfavorable returns. They bought beer and wine at the bar and munched on bacon-wrapped shrimp, cheese quesadillas and bruschetta.

Katherine Devine, the campaign manager for state Senator Beth Bye, came to Malloy’s party after her boss declared victory. At around 11:30 p.m., when about half of the precincts had reported and Foley was up by about a percentage point, she said she was not feeling nervous.

“We think we’re going to end up one or two percentage points ahead,” Devine said. “We just haven’t counted it all yet.”

Early in the evening, United States Senators Richard Blumenthal LAW ’73 and Chris Murphy spoke, praising the governor. Democratic Party Chairwoman Nancy DiNardo thanked attendees, especially organized labor, for their work. After those speeches, however, a sense of ennui set in as results slowly trickled out to the crowd.

The crowd cheered when Elizabeth Esty LAW ‘85 declared victory over Mark Greenberg in the 5th Congressional District, and when Kevin Lembo defeated Sharon McLaughlin to retain his position as comptroller. To stave off the boredom that set in after those interludes, the Malloy team blasted Michael Jackson songs including “Beat It” and “Thriller.”

Though the tense optimism regarding Malloy’s electoral fate never wavered, the Democrats were chastened by defeats across the country. Republicans won control of the U.S. Senate and expanded their majority in the House of Representatives.

The bad news for the Democrats seemed to come to an end shortly after 12:30 a.m., when Malloy took the stage and declared victory before a crowd of jubilant supporters. After the speech, Malloy and his wife worked the crowd, giving hugs and posing for photographs. But Foley still refused to concede, claiming the race was too close to call.

“Malloy’s saying he’s won, but I don’t buy it,” one Foley supporter who asked not to be named said. “This has just been a lot of hurry up and wait.”

Foley’s supporters got clarity at around 12:45 a.m. when Foley finally appeared to address them after a five-hour wait.

“Something a little unusual has just happened,” Foley quipped. “Dan Malloy has just announced that he thinks he’s won the race.”

Foley’s declaration that he would not concede the race to Malloy until he “had all of the numbers” was met with resounding cheer.

Still, he acknowledged that the race was likely lost.

“Don’t get too excited,” Foley said. “Because we probably have lost this race.”

In the 2010 race, Malloy edged out Foley by less than 7,000 votes.