The knock on the front door of Charlie Sheen's troubled ex-wife Brooke Mueller's home came around 9 p.m. on May 2. Social workers from L.A.'s Department of Child and Family Services, alarmed by Mueller's erratic behavior in recent weeks, had arrived for one explicit reason: to take custody of her two 4-year-old twins, Bob and Max.

"It was a real mess," says a Sheen friend familiar with the incident.

But what happened next came to many as a shock.

Denise Richards, 42, Sheen's ex wife, stepped forward to offer her help, caring for the children. "Denise told Charlie that she wished she could take them," says a source in their circle. "Someone needed to step up."

This arrangement was not exactly foreign to her.

Richards – who has two daughters, Lola and Sam, with Sheen, and adopted another daughter, Eloise, on her own – has quietly cared for Mueller's brood on several occasions when Mueller's battle with drug addiction has forced her into rehab. Sheen supports the arrangement and, according to the Sheen friend, often gushed about Richards being "a stable, very maternal" influence on the twins.

Even Mueller, 35, initially supported the decision. "This makes the most sense," says a Mueller pal. "The boys can continue going to their school, and they love their sisters."

No Longer an Informal Situation

This time, however, the authorities are getting involved with the threesome's informal setup.

On May 7, an L.A. county juvenile court judge agreed to grant Richards temporary custody of the boys – a decision Sheen supports.

"He loves those kids," says the Sheen source. "But he's got a crazy work schedule, filming two shows a week and would rather they spend time with Denise and their daughters than with a nanny at his empty house."

Mueller, however, has reportedly had a change of heart about the situation, and is not thrilled with Richards stepping in for her while she completes rehab at the Betty Ford Center.

"Brooke is angry that Denise may take the kids," says the Mueller friend. "She's decided she wants the boys to be with her brother and sister-in-law."

Whether a judge will allow that is unclear, although another hearing on the issue is reportedly scheduled for next month. Mueller, who friends say has overdosed six times in the past two years, will spend the next three to six months at Betty Ford, trying to kick her addiction.

"Brooke is determined to get her life back," explains the Mueller pal, "and get the help she needs."