Appointed U.S. Sen. Michael Bennet will be elected to the U.S. Senate after pulling ahead of challenger Ken Buck this morning.

Long after most Coloradans — including the candidates and their supporters — had gone to bed, returns from Denver and Boulder moved Bennet past Buck and into the lead, 47.5 percent to 47.1 percent.

A recount would be required if the difference between the two candidates’ vote totals is less than one-half of 1 percent of the highest vote total, or about 3,900 votes based on current tallies.

Bennet leads by nearly 7,000 votes with an estimated 30,000 still to be counted in Boulder County.

The race, which most polls predicted would be tight, lived up to expectations. As the count extended beyond midnight, Buck clung to a tenuous lead of only a few thousand votes, with each candidate claiming about 47 percent of the total.

Though Republicans were cautiously jubilant as their candidate pulled ahead, many were perplexed as to why the race was as tight as it was amid what they perceived as widespread Republican momentum.

“It’s a little strange seeing it this close,” said Marc Massey, an attorney and Buck supporter attending the victory party in Greenwood Village. “Some parts of this state we’ve seen big Republican surges, but maybe not in the metro area.”

Sean Tonner, a GOP strategist who helped Buck’s opponent Jane Norton in the primary, agreed.

“It’s a little closer than I thought it’d be,” he said. “This is a big year for Republicans and it’s still close.”

The result carries implications for the balance of power in the Senate — which, with the Democrats’ loss of the House, looms crucial for President Obama’s ability to continue his agenda. Although Republicans needed a net gain of 10 seats to assume the Senate majority, late returns had them narrowing the gap but falling short of gaining control.

The razor-thin margin had Democratic officials noting that, when every vote is tabulated, the difference may be as little as 2,000 votes.

Then, provisional ballots will have to be counted — a process that takes days — and Colorado reported much higher than usual provisional ballots cast Tuesday, according to Secretary of State Bernie Buescher.

Terry Stone, who served as an election judge in Denver all day before joining the Democrats’ party, said of the 900 votes in his precinct, 100 were provisional, and he’s heard the same from all over the city.

Arapahoe County also reported so many requests for provisional ballots that Buescher had to issue an order allowing photocopies and other unusual forms of ballots to be collected. There are likely to be fights over those facsimiles if the vote remains that close.

“We pulled up a chair and we’re going to wait it out,” said Jones, stationed in front of one of the large screen TVs at the Denver Marriott City Center, site of the Democrats’ gathering.

All night, both parties exuded optimism.

“We are seeing a groundswell of support for Michael across the state, and that’s encouraging,” said Trevor Kincaid, Bennet’s campaign spokesman.

At the GOP gathering, the crowd morphed from sleepy to elated as the night dragged on and returns showed Buck closing the gap.

“Buck! Buck! Buck!” the crowd chanted, as Fox News noted the challenger’s deficit disappearing.

“We’re optimistic right now, there’s still a lot of votes out there in rural Colorado and El Paso County,” said Buck spokesman Owen Loftus. “Ken is optimistic…We’re seeing our race’s margin narrow.”

Earlier, Wadhams made the rounds at the GOP party, oozing confidence as he described the difference between 2008 and 2010 as “immeasurable.”

“We’re going to win,” he predicted. “Ken Buck is going to be the senator. You can’t even compare it to 2008 — I was waiting for the guillotine, hoping it wouldn’t be too painful.”

Already looking forward, he said that the constantly shifting political climate makes Colorado an interesting stage.

“It’s always completely different every year, different issues,” he said. “And it’s all going to be different again in 2012. We start tomorrow.”

Sen. Mark Udall added that the Democrats’ computer modeling suggested Bennet was hitting his projections in every part of the state.

“It appears our get-out-the-vote operation is producing,” Udall said. But he added that it felt odd not to be running a race of his own.

“You get used to being on the ballot,” he said. “I’m like a parent who’s watching his kids go out and battle. But I’m listening to voters as well. They’re saying get to work on jobs and please work together.”

While Democratic party leaders huddled behind a curtained off area of a hotel ballroom to check computer results, Jessie Ulibarri, from a coalition of Latino get out the vote groups, said high voter turnout among Latinos will help shape 2012 no matter who wins the Senate race.

“We’ll refocus and show how big the Latino voting bloc has become,” said Ulibarri. “It’s a long battle. We’ll continue fighting.

In Colorado, the very early advantage leaned strongly to Republicans, who mounted a more than 60,000-ballot advantage over Democrats in mail-in voting. Democrats were banking on a strong election-day turnout — and help from unaffiliated voters, particularly women.

At his campaign camp at the Denver Marriott City Center, Bennet moved back and forth along the TV riser early in the evening, giving live interviews to national and local media. He sounded upbeat but also urged viewers to get out and vote during the last hour the polls would be open.

Buck spent the afternoon in Greeley at home with his family, staffers said. He did a honk-and-wave there before making his way to the GOP bash.

Former Gov. Bill Owens, excited at the prospect of sending two more Republicans to Washington, said a mixed Congress might make the Obama administration more effective.

“I served as governor with a mixed legislature and a Democratic legislature and I think you can get a lot done,” Owens said.

Bennet, a relative political unknown when Gov. Bill Ritter plucked him from his job as Denver Public Schools chief and appointed him to the post 22 months ago, benefitted from his time in Washington to establish a solid financial base for what proved a costly campaign. He raised $6 million alone to fend off primary challenger Andrew Romanoff.

Buck, the Weld County District Attorney, tapped into the anti-incumbent anger of the Tea Party movement for early momentum and a primary win over Jane Norton before moving toward the center on several issues for the general election.

Cascading money was a theme throughout the campaign, as Colorado became the most expensive race in the country for outside spending by both conservative and progressive groups. Pro-business, union and other organizations spent more than $32 million in Colorado, on top of the more than $15 million expected from the Bennet and Buck campaigns.

Senate attack ads dominated local TV, funded largely by groups whose donors remain anonymous under current campaign laws.

In the general election, Bennet basked in visits from former President Bill Clinton, who drew the biggest rally crowd of the Colorado elections, and First Lady Michelle Obama, who raised $270,000 for Bennet on one October afternoon.

Buck, pursuing the first Republican Senate win in Colorado since 2002, spent considerable time roaming the Eastern Plains and Western Slope, mining support in small gatherings where his down-home personal style connected directly with voters.

But on the public stage, he committed some gaffes that contrasted sharply with his earnest straight talk aimed at conservatives and independents weary of a Democratic regime.

He backstepped on many red-meat positions he took to win the Republican primary — his support of the Personhood Amendment, the consumption tax, supporting a Constitutional Amendment to ban abortion and using an abortion litmus test for federal appointments.

In debates, he often came off as low-energy and vague about specific ideas to solve problems. During an appearance on “Meet the Press,” he compared the roots of homosexuality to alcoholism.

Bennet had his problems, too.

While he benefitted from the in-place Democratic machinery, he was also immediately saddled with the Democrats’ perceived responsibility for high unemployment and ballooning deficits.

Bennet’s cerebral approach to the campaign trail didn’t always connect with voters. His lament that America had $13.5 trillion in federal debt “with nothing to show for it” was downbeat and complicated, without offering details on how he would reverse it.

From the first day of the general election, his campaign sought to shift the focus to Buck’s allegedly extreme views.

Democrats had spent the primary collecting “tracker” video footage of Buck veering right with friendly audiences, forcing Buck to waste valuable campaign time defending those positions or appearing to back away and flip-flop.

Those jabs may have scored Bennet some points, but the tactic left him vulnerable to Buck’s effective counter-punch that he was ignoring jobs and the economy.