(CNN) In a vote in the early Wednesday morning hours, the Senate approved the final version of the first overhaul of the US tax code in more than 30 years, handing President Donald Trump and congressional Republicans their most significant legislative victory of 2017.

The bill passed along party lines, 51-48 with the final result announced by Vice President Mike Pence who presided over the vote. Sen. Jeff Flake, the last undeclared Republican, voted yes.

The House passed the bill earlier Tuesday, but technical changes were made to it in the Senate, and the bill will go back to the House on Wednesday for a revote, where it is expected to pass again. It will then head to the President's desk for his signature before the Christmas holiday, making good on the Republican Party's promise to enact tax relief by the end of the year.

At around midnight, Senate Minority Leader Chuck Schumer made his final pitch to his colleagues to vote against the tax bill. It was the same kind of impassioned speech Democrats made all evening, but Schumer looked directly at his colleagues and said that this is "some bill for the middle class," noting the heftiest provisions will help corporations.

As the vote unfolded, Sen. Tim Scott, a key negotiator in the tax bill and someone who was tapped to lead part of the effort, went up to Senate Finance Chairman Orrin Hatch and Hatch put his arm around them. On the floor, senators cheered when the bill was passed.

Protesters also could be heard during the final vote Wednesday morning. A group of onlookers above the Senate floor in the chamber begin yelling "kill the bill, don't kill us" before they were escorted out by law enforcement shortly before the start of the final vote.

House Speaker Paul Ryan spoke earlier from the floor of the House in advance of their first vote and said that this was a "generational defining moment."

"This is without question the single most important thing we can do to once again make America the best place to do business," the Wisconsin Republican said.

Protesters were repeatedly removed from both chambers throughout the day.

Now, Republicans are just hours away from officially collecting their first major legislative win this year, one that not only delivers on a campaign promise to overhaul the US tax system, but also nets another GOP pledge to repeal at least part of the Affordable Care Act in ending the penalty tied to Obamacare's mandate to have health insurance.

But the victory is also at least in part a gamble Republicans are making ahead of next year's midterm elections, as the party will vote for the legislation amid tough poll numbers for what it's proposing to do as well as critical analyses that say the plan will add billions to the national debt and eventually raise taxes on some key groups.

But in the end, no bad analysis, no bad poll, no bad headline has dissuaded Republicans from moving forward on this bill. Nothing at this point is going to change that.

The policy

CNN has covered what's in the final bill extensively, but here are just a few of the highlights: The plan -- which critics say is heavily weighted to ease the tax burden of businesses rather than the middle class -- drops the corporate tax rate down from 35% to 21% , repeals the corporate alternative minimum tax, nearly doubles the standard deduction for individuals and restructures the way pass-through businesses are taxed. The bill keeps seven personal income tax brackets, and lowers that tax rates for most brackets, including dropping the top rate to 37% from 39.6%.

The final analyses of the GOP House-Senate conference report are also starting to come in. Here's a quick rundown:

Joint Committee on Taxation: The JCT found that all income groups will, on average, see a tax cut in 2019, though the projections worsen over time. In 2019, all taxpayers would see an 8% tax cut. In total, about 10 percent of the $1.5 trillion tax cut would go directly into middle households. Those making more than $500,000 would receive approximately 12 percent of the total tax cut. The JCT, however, found that by 2027 taxpayers earning up to $75,000 would receive a tax increase -- this would stem from the sunsetting individual rate cuts in the final GOP bill, along with the repeal of the Affordable Care Act's individual mandate.

Tax Foundation: The bill will increase the debt by $448 billion over the next 10 years when scored on a dynamic basis (accounting for growth provisions in the bill.) This is a more optimistic view of things than other analyses -- the Tax Foundation is considered more aggressive with its assumptions for economic growth than other entities -- yet the legislation still clearly adds to the debt over 10 years, contrary to some Republican promises.

The analysis also showed the bill would boost gross domestic product by 1.7% on a long-term basis.

Tax Policy Center: The Tax Policy Center found that the final bill would reduce taxes on average for all income groups in 2018, with higher income houses receiving the largest average tax cuts per percentage of after-tax income. The largest cuts would go to taxpayers in the 95th to 99th percentiles of income. The TPC projected that individual taxes would be reduced on average by $1,600 in 2018, but by 2027 more than half of households would face an average tax increase of $180.

Why Susan Collins is a yes

As CNN has previously reported, Collins asked for specific things in the Senate tax bill:

An expansion of the medical expense deduction

The expansion of the State and Local Tax deduction

The re-instatement of catch-up contributions for public employees

Her vote was contingent on those things, plus future guarantees on two health care items -- the bill from Sens. Lamar Alexander and Patty Murray that includes funding for Obamacare's cost-sharing reduction subsidies and a separate bill with Democratic Sen. Bill Nelson that would create a reinsurance fund.

She got the tax provisions, and she got a guarantee from Senate Majority Leader Mitch McConnell on the future health care proposal. She also got a guarantee from McConnell and Ryan that pay-as-you go automatic cuts to programs like Medicare would be waived before they would be triggered by the deficit-heavy bill.

Same goes for this time around. All three of the Collins asks were included in the final legislation (as well as some other provisions she'd been working on during the process). McConnell's guarantees on the other provisions stand -- and several aides have made clear McConnell intends to follow through on his promises in the year-end spending bill.

So she was a "yes." And not a tepid one. She gave a lengthy floor speech expounding on what she saw as the virtues of the tax bill. One that included this:

"The right question to ask is, 'Does this tax cut make the American people better off?' And the answer to that question is yes," she said.

Will McConnell deliver on the other issues? It's a great question -- one people have been trying to figure out for a few weeks now. House Republicans are deeply opposed to the health care legislation and House Democrats have already said they have no intention of helping to waive the "paygo" trigger.

For Collins (and more importantly, McConnell) there's work to be done, but for now, the promise was enough.

About McConnell's promise: What McConnell promised Collins isn't a sure thing -- again, House Republicans are deeply opposed to the health care provisions and Democrats, according to several people involved in the year-end spending negotiations, have little appetite to help the Republican leader finalize a deal in the midst of a partisan tax overhaul push.

But the dynamic at play here is a very important one -- McConnell is about to have his majority cut down by one senator. That makes Collins in extremely valuable player in whatever happens in 2018. Alienating her -- and failing to deliver on something that she has staked her vote on -- is a seriously bad play.

And McConnell knows this, according to aides. But more importantly, there's the long game in general. McConnell made a big show of this promise to Collins -- even engaging in a colloquy on the floor cementing the deal. Now, Democrats have chuckled at this, but for McConnell, keeping a promise to someone in his conference, particularly on something as high stakes as this, carries major weight in the future, when, say, he has to ask another senator to take a very, very tough vote in exchange for something in the future.

Again, nothing's is assured. But this is precisely why McConnell has made clear he wants to address what Collins was promised in the year-end spending bill. He is keenly aware the stakes are very high, both in the near term and long term, for his time leading the GOP conference.

This story has been updated and will continue to update with additional developments.