EXCLUSIVE: 'Keeping Up With the Joneses' Star Zach Galifianakis Reveals His Past Real-Life Spy Mission

Galifianakis revealed to ET that he took on an interesting odd job before making it big in Hollywood.

Zach Galifianakis' character gets a taste of the spy life in his new comedy, Keeping Up With the Joneses, and it turns out, that's not the first time the actor has found himself undercover.

"I got hired in New York to spy on someone once," Galifianakis told ET while promoting Keeping Up With the Joneses with co-star Jon Hamm. "This private investigator had hired me to go into a gay bar and hit on a guy whose wife thought he was cheating on her with other men."

WATCH: Hillary Clinton Makes Hilarious Appearance on 'Between Two Ferns' With Zach Galifianakis

The comedian admitted to feeling "guilty about it afterwards," and to top it off, he failed the mission.

"The guy was just not interested in me whatsoever," he said with a laugh.

"Well, I'd explain why I said no," Hamm joked.

"That's how Jon and I met," Galifianakis quipped.

WATCH: Zach Galifianakis Says Donald Trump Has 'Mind of an 11-Year-Old,' Doesn't Want Him on 'Between Two Ferns'

In the movie, Galifianakis and Isla Fisher play a suburban couple who become embroiled in an international espionage plot when they discover that their seemingly perfect new neighbors (Hamm and Gal Gadot) are spies.

The upcoming comedy is filled with laughs and action, but there's one thing you won't see.

"Zach and I had a really tasteful lingerie scene that got cut out of the film," Hamm said.

"Two thongs don't make a right," Galifianakis kidded.

Keeping Up With the Joneses opens Oct. 21.