Katy Perry and Russell Brand Credit: JB Lacroix/WireImage.com; Mark Davis/WireImage.com

Think fast!

Katy Perry crouched under her table when she spotted former husband Russell Brand at the Beverly Hills Polo lounge, where she was dining with beau John Mayer Nov. 11.

"The hostess almost seated Russell next to Katy," a witness tells Us Weekly. "Katy's face was like, 'Oh, s--t!'"

After the staffer realized her error, she ushered Brand, 37, to another section.

When the comic learned Perry, 28, was there, he couldn't help but gawk.

Says the source, "On his way to the bathroom, he looked at [John and Katy] through a window!"

Perry, who married Brand in a lavish ceremony in India in October 2010, was blindsided when the British comedian filed divorce papers the following December. (The couple's divorce was finalized in July.) She has since moved on with Mayer, whom she showed around her hometown of Santa Barbara earlier this month.