D.C. Council members rolled over Mayor Vincent C. Gray and Chairman Kwame R. Brown on Tuesday when they unexpectedly rejected a plan to repay city workers for furlough days last year.

In a blow to Gray and Brown’s efforts to manage a fractured council, members derailed two compromises the two Democrats had hammered out. The agreements were part of a $63 million package for new spending from an unexpected budget surplus.

After the council turned back a similar proposal two weeks ago, Gray and Brown agreed last week to spend about $22 million of the surplus to repay more than 20,000 workers who had taken four unpaid holidays because of budget pressures.

But during Tuesday’s unruly session, the 12-member council deadlocked over the issue, exposing differences over how to spend extra tax dollars.

“When you are dealing with 12 different characters, things just change,” said Vincent B. Orange (D-At Large). “There is more work to be done — more work to be done on the mayor’s part, the chairman’s part and the council members’ part.”

Noting that Gray’s proposed supplemental budget also included $25 million for schools, mayoral spokesman Pedro Ribeiro called the council decision “shortsighted and irresponsible.”

“We are disappointed this council failed to approve this, immensely,” said Ribeiro, who thanked Brown for his efforts. “The vote puts thousands of . . . students at risk.”

Coming just days before the council begins the final negotiations on next year’s budget, Tuesday’s vote served as a reminder that neither Gray nor Brown has control over the council, as both await the outcome of federal investigations into their respective campaigns.

After the vote, council staff members and administration officials privately traded accusations over who was responsible for initially securing the votes needed to pass the emergency spending plan. But one senior council staff member, who spoke on the condition of anonymity in order to discuss the matter freely, said the body has devolved into a “free-for-all” where personal animosity and ambitions make consensus difficult.

At times Tuesday, the debate over the plan grew heated as council members vented their frustrations during a morning breakfast meeting and the following session.

“You’re so idiotic, Jim,” Jack Evans (D-Ward 2) told Jim Graham (D-Ward 1) over breakfast as they debated how to use the surplus.

The deal for spending the funds in this year’s budget began to unravel early Tuesday when several council members rebelled against the Gray-Brown agreement, saying some of the city’s estimated $240 million surplus should also be used to shore up affordable housing, health care and assistance to needy families.

David A. Catania (I-At Large) said he would support it only if city employees were paid for two days to free up money to direct $5 million for a city program that provides free health care to undocumented immigrants.

When some members balked, Catania compared them to the tea party and Jan Brewer, the Republican governor of Arizona, who signed tough immigration legislation.

Meanwhile, Michael A. Brown (I-At Large) pushed for an additional $5 million for affordable housing programs, while Graham threatened to withhold support unless his colleagues also rolled back some of the recent cuts to the Temporary Assistance for Needy Families program.

Michael Brown and Catania proposed an amendment that would have repaid city workers for two days, with $10 million going toward affordable housing and the health insurance program.

During a break in the proceedings, Gray and the council chairman signed off on the compromise to try to guarantee passage. But the measure was defeated 7 to 5 after some members said they could support repaying employees only for the full four days.

A few minutes later, Brown brought up the initial proposal that included repayment for all four furlough days. But the council deadlocked 6 to 6 when several members said they needed more time to explore how best to spend the surplus.

“I am very concerned about, in the course of a couple hours, divvying up this amount of money without looking at all the priorities of the government,” said Muriel Bowser (D-Ward 4). “I am concerned some should be paid and others, well, tough luck.”

The vote was also a setback to public employee unions, which lobbied for the full four-day repayment.

After the vote, George “Geo” T. Johnson, executive director of AFSCME Council 20, said he was misled by some council members. Johnson was particularly upset with Marion Barry (D-Ward 8), who voted against the bill.

Barry said he supports repaying the workers for four days but wanted to take a few weeks to evaluate the city’s spending needs.

“Folks crossed folks,” Johnson said. “Marion did some things he shouldn’t have done, and some things are going to come sooner than they think it’s going to come. That is not a threat. It’s a promise.”