Apparently what happens in Vegas stays there ... until your lawyer finds out about it.

Such is the lesson Janeane Garofalo and writer/producer Rob Cohen reportedly learned when they discovered they'd been married for the past 20 years, and just didn't know it.

According to the New York Post's Page Six, Garofalo recently recounted the scenario during the "Ben Stiller Show" reunion at the New York Comedy Festival. The 44-year-old comedic actress said that she married Cohen, a former writer for the "Ben Stiller Show," in Vegas as a joke, not realizing that the marriage was the real deal.

"Rob and I got married, for real, which we had to have a notary dissolve not 30 minutes before we got here tonight,” Garofalo said Saturday. “We were married for 20 years until this evening.”

It all began the way most things happen in Vegas (or so we hear): with plenty of drinks.

"We got married drunk .... We dated for a year, and we got married at a drive-through chapel in a cab," she recalled. "[We thought] you have to go to the downtown courthouse and sign papers and stuff, so who knew? We were married, and apparently now that [Rob] is getting married for real, his lawyer dug up something."