Williams, recuperating from a heart valve operation to correct an irregular heartbeat, had been sitting in the back of the theater during comedian Mark Pitta's weekly comedy night.
"We expected him to just watch," said Lucy Mercer, the theater's founder and artistic director. "He's still fragile, obviously."
But toward the end of the show, the lure of the stage became too strong for Williams to resist.
"I was saying goodnight to the crowd when he walked up, and I'm like, 'no way,'" Pitta said. "It was a total surprise to me. Then he went on to do 30 minutes."
Once he was on stage, the famously manic comedian confessed that he couldn't just sit in the back while other comics made people laugh.
"You know I'm a whore for an audience," he told the packed house.
The 57-year-old comedian is known to be a bundle of sweaty energy while performing, but this time fans became concerned when he appeared to be laboring even harder than usual.
"Ten minutes in, he was out of breath," Pitta said. "He kept saying, 'The doctors said I shouldn't be here. I need another month down.' It was like watching 'The Wrestler' with Mickey Rourke, only with comedy, and Robin up on top of the ropes, leaping off."
Williams, who has been living in Tiburon since his second wife filed for divorce last year, postponed his sold-out one-man comedy tour, "Weapons of Self-Destruction," after being hospitalized with heart problems and undergoing surgery at the Cleveland Clinic on March 13.
The 3.5-hour operation involved replacing his aortic valve and repairing his mitral valve. His doctors said he is expected to make a complete recovery.
He jokes that the next leg of the tour, expected to resume in the fall, will be called "Weapons of Self-Destruction and Reconstruction!"
There is a history of heart disease in Williams' family. In August 2007, his older brother, Robert Todd Williams, died of complications from heart surgery.
As he often did when he was developing material for his tour at the Mill Valley theater, Williams got into some good-natured bantering with members of the audience, joking about the cow's valve that was used to repair his heart.
"Somebody asked him from the audience if he craved different foods," Pitta said, "because he heard that with that surgery, a bovine valve, that's what happens. Robin said, 'Well I'm grazing more.'"
At one point, Williams engaged in an exchange with Corinna Kaufman, a 54-year-old "guided image practitioner and hypnotherapist" from Novato.
"In Marin, there's so much material based on that," Mercer said, commenting on Kaufman's new-agey occupation. "He went back and forth with her."
For her part, Kaufman was afraid the always antic Williams had over-taxed his newly repaired heart.
"He kept saying, 'My heart is going so fast,' and pounding his chest," she said. "He was so excited just being on stage that he said his heart was jumping all over the place. I was worried that he would keel over right there."
Williams was remarkably candid, talking about his surgery, his doctors and nurses, dealing with pain, other intimate matters.
"Personally, I think it was good for him," Mercer said. "He was really open with people. It was wonderful. This is his community."
Pitta concurred, saying, "At the end of it, in the Green Room, he looked at me and said, 'I needed that.'"