After a dramatic and chaotic day of votes, Congress late Friday approved a stopgap bill to keep money flowing to the Homeland Security Department past a midnight deadline and avert a partial agency shutdown -- though Congress is no closer to a long-term deal.

The House voted 357-60 for a mere one-week spending bill. With the Senate already having approved the measure. President Obama signed the bill into law late Friday night.

But that legislation was passed only after efforts to pass a slightly more substantial stopgap – a three-week funding bill – melted down on the House floor Friday afternoon. Though it had been expected to pass, 52 Republicans defected and joined Democrats in opposing the leadership-backed legislation.

This led to bad blood late Friday between House Republicans who joined Speaker John Boehner in supporting the bill, and those who peeled off. One senior House GOP source told Fox News that the nearly 200 Republicans who backed that bill were “super mad” at those who left them hanging.

"There are terrorist attacks all over world and we're talking about closing down Homeland Security. This is like living in world of crazy people," tweeted Rep. Peter King of New York, a former chairman of the Homeland Security Committee.

More On This...

In the end, Boehner was able to pass the one-week measure with the support of some Republicans, as well as Democrats – after Leader Nancy Pelosi, D-Calif., told her caucus they could reverse course and back the last-ditch measure.

While DHS is funded for now, however, Congress’ punt only underscored the deep divisions over the way forward in a debate that centers not on DHS funding but the president’s controversial immigration executive actions.

Conservative Republicans want to reverse those actions as a condition for funding DHS. Democrats want to pass a stand-alone, full-year funding bill with no immigration provisions attached. But while some corners of the Republican caucus have backed down – namely in the Senate -- rank-and-file Republicans in the House have not.

"I am not going to vote under any circumstances to fund illegal conduct," Rep. Mo Brooks, R-Ala., said earlier. "If it's illegal, it's illegal."

Their insistence on using the DHS funding as leverage to reverse or undermine the president’s immigration agenda leaves Boehner in a tough spot.

At some point, he could potentially resolve the stand-off by steam-rolling his rank-and-file to work with Democrats and pass the kind of long-term “clean” funding bill they want. There was speculation in the run-up to the late-Friday vote that he and Pelosi had struck a deal to do exactly that next week. (A spokesman for Boehner denies this.)

But on the Senate side, Majority Leader Mitch McConnell, R-Ky., has already met Democrats' demands to deal with the two issues separately. With his blessing, the Senate on Friday approved a longer-term, stand-alone DHS funding bill. However, House Republicans stalled that bill, voting instead for a so-called conference committee -- a way for lawmakers to hammer out a compromise measure.

But Senate Democrats have called this a "non-starter," and are trying to block it, teeing up another set of votes on that next week – unless the House takes a different tack. Meanwhile, Senate Democrats on Friday also blocked a separate bill undoing Obama's immigration actions.

The complicated debate leaves unclear how lawmakers can resolve the impasse, with Democrats not budging and Republicans divided over how far to take their fight against Obama's immigration plan, which gives millions of illegal immigrants work permits and a deportation reprieve.

Some argue that with a federal judge, for now, blocking the plan from going forward, there's less urgency to use legislation to achieve the same goal. Other conservative Republicans say the legislation is necessary.

"Some folks just have a harder time facing political reality than others," said Rep. Charlie Dent, R-Pa., speaking of other Republicans.

Fox News' Chad Pergram and The Associated Press contributed to this report.