WASHINGTON (AP) — A filibuster averted. A likely accord on immigration reform. A former Republican presidential candidate thanked — publicly! — by the Senate’s top Democrat. Lawmakers of both parties lunched together for the first time many could remember, agreeing to agree on the heroism of Sen. John McCain and the tragedy of the Newtown, Conn., massacre.

Bipartisanship broke out on Capitol Hill on Thursday, a newsy development after years of polarization that infuriated the public, brought Congress to a near-halt and the country to the brink of economic disaster. It could all blow to pieces by the time you read this article — fierce disputes remain on gun control and immigration, among others issues. And looming over it all is a midterm election next year with big implications for the divided government and President Barack Obama’s legacy.

But let history record that for a full day in battle-scarred Washington there it was: legislative progress, bipartisan bread-breaking and the emotional stuff of human relationships long-mourned and little-seen in recent years.

Obama helped set the harmonic tone in his budget Wednesday, calling for cuts in benefit programsRepublicans have been seeking for years, a gesture widely seen as an effort to preserve the prospects of immigration and gun control legislation.

But at the center of all of the civility was McCain, the president’s vanquished GOP opponent from the 2008 presidential election. The gruff Washington veteran, Vietnam war hero and, lately, scolder of would-be obstructionists in his own party threw cold water on a filibuster threat by 13 conservative senators who oppose gun control.

“What are we afraid of?” the Arizona senator said Sunday on CBS’ “Face the Nation.” ”Why not take it up and amend it and debate?”

A bipartisan gun control deal by freshman Sens. Pat Toomey, R-Pa., and Joe Manchin, D-W.Va., inspired Senate conservatives to drop their filibuster plans, even though many Republicans who allowed the legislation to advance said they were unlikely to vote for its passage. Also helping to remove the obstruction were the family members of some of the 20 children and six adults murdered by a gunman at Sandy Hook Elementary School who had spent days lobbying lawmakers for strictergun control laws. Several lawmakers said they were brought to tears in those meetings.

On Thursday, the Senate departed from its streak of legislating by filibuster. Under the grim gaze of Sandy Hook victims’ relatives, 16 Republicans voted with 50 Democrats and two independents to begin debate on tightening the nation’s gun laws. In the gallery over the chamber, some in the delegation wiped away tears, held hands and appeared to pray as each senator cast a vote.

Much emotional debate lay ahead and the Toomey-Manchin bill’s fate was far from certain. But after the vote, Senate Majority Leader Harry Reid gave Republicans — “especially John McCain” — some rare, nationally televised credit for the progress.

“There have been many things written in the last several months about how the Senate cannot operate,” Reid, who frequently decries congressional dysfunction, said on the Senate floor. “John McCain has been a leader in this country for 31 years. People respect his opinion.”

Senators then adjourned to spend time together at a lunch for McCain to celebrate the 40th anniversary of his release from captivity in Vietnam. In a gilded room named for John, Robert and Edward Kennedy, surrounded by black-and-white photos of a young McCain returning on crutches, Republicans, Democrats and independents dined on enchiladas and tilapia as McCain revealed harrowing details of his captivity and torture.

The account of McCain’s five years as a POW was new to some in attendance. Several said they were moved to tears by it, reminded again of bigger matters than how this or that vote would go over with certain constituents back home.

“It makes you think about the human condition,” Sen. Chuck Schumer, D-N.Y., said.

Even Sen. Rand Paul, the Kentucky Republican tea partyer whose 12-hour filibuster delaying the confirmation of John Brennan as CIA director inspired a rebuke from McCain, emerged reporting good times.

“He got a standing ovation from both parties,” Paul said. “The idea of defending the country brings everybody together.”

Late in the day, there was even more apparent progress: Four Democratic and four Republican senators reached agreement on all the major elements of sweeping legislation to remake the nation’s immigration laws, and expect to unveil the bill next week.

Don’t get used to all this civility and forward motion, Reid warned.

“The hard work,” he said, “starts now.”