And, just like that, President Obama can claim that rarest of things during his seven years as president: A congressional victory.

House Minority Leader Nancy Pelosi's reversal -- she had previously said that the votes were simply not there for Trade Adjustment Assistance (TAA), a program to compensate workers who lose jobs because of trade deals, in the House and had voted against it last week -- essentially ends a standoff between Congress and the White House over the parameters by which Obama can negotiate the Trans Pacific Partnership.

What's fascinating about this fight is that it was congressional Republicans -- Obama's longtime and sworn enemies -- who held firm to push the trade measures over the line. It was an unlikely partnership that shows just how much the president is focused on building pieces of a decidedly scant collection of second-term legacy items.

[The trade deal, explained for people who fall asleep hearing about trade deals]

In the wake of House Democrats' revolt on TAA, which Pelosi didn't lead but signed on to in its final hours, Obama made clear that he was 1) not done pushing for fast-track trade authority (TPA) and 2) he would work with Republicans to make it happen.

This is how the New York Times cast it in the wake of the initial defeat on the House floor:

In an extraordinary twist that perhaps only a lame duck president can relish, President Obama has largely jettisoned his plan to lure House Democrats to get his trade agenda through Congress, and instead is now working closely with Republican leaders.

After weeks of wooing, pleading with and occasionally berating members of his own party in the hope that they would get behind what could be his last major economic policy achievement, Democrats delivered a mortifying defeat to his trade package on the House floor last Friday, sparking a change in strategy.

What came next was a classic bit of power politics with Obama, House Speaker John Boehner and Senate Majority Leader Mitch McConnell pulling the strings. The House GOP decoupled TPA and TAA and passed the trade promotion legislation by itself. That then went to the Senate where, on Tuesday, it got the 60 votes it needed to end debate and force a vote on final passage today -- where it is was easily approved. That will then be followed by a vote on TAA, which will also be approved by the Senate, too.

In essence, what Obama and the two congressional leaders did was gamble that if they could get TPA approved separately then there was no way that House Democrats would tank the entire thing by, again, voting against a measure in TAA which they have long supported. That gamble paid off Wednesday when Pelosi acknowledged the obvious -- that TPA and TAA would both pass the House.

While the bedfellows that led to this deal seemed strange indeed, a close reading of what Obama and McConnell said in the wake of the 2014 elections provided some hint that what just transpired was possible.

Here's Obama on Nov. 5, 2014 in his post-election press conference:

But I do think there are going to be areas where we do agree -- on infrastructure, on making sure that we’re boosting American exports. And part of my task then is to reach out to Republicans, make sure that I’m listening to them. I’m looking forward to them putting forward a very specific agenda in terms of what they would like to accomplish. Let’s compare notes in terms of what I’m looking at and what they’re looking at, and let’s get started on those things where we agree. Even if we don’t agree 100 percent, let’s get started on those things where we agree 70, 80, 90 percent.

And here's McConnell from that same time:

We ought to see what areas of agreement there are and see if we can make some progress for the country. I always like to remind people that divided government's not unusual in this country. We've had it frequently -- I think maybe even more often than not since World War II. When the American people choose divided government, I don't think it means they don't want us to do anything. I think it means they want us to look for areas of agreement.

I -- and I think lots of other people -- rolled their eyes at these sentiments, assuming they were empty rhetoric designed to throw a bone to bipartisanship but with no expectation of anything coming off them. After all, McConnell had famously said early in Obama's first term that "the single most important thing we want to achieve is for President Obama to be a one-term president" -- a quote cited time and again by the president during his 2012 campaign. Trust was at historic lows. Obama had decided to end-run Congress via a series of executive orders. Republicans saw the 2014 election as a validation that the American public didn't agree.

Lost in all of that was the fact that Obama was desperately in need of a major second-term accomplishment after watching gun control and immigration reform collapse in Congress. And that McConnell and Boehner were equally desperate to prove that they could govern and not simply obstruct.

Now, there's still plenty that could go wrong. This is not the trade deal itself but rather the parameters by which Obama can negotiate the TPP. But it's a whole hell of a lot further than most people would have thought Obama and Republicans might get on ... well ... anything.

Politics is a strange and totally fascinating business. This trade deal proves it. Again.