Justin Theroux and Jennifer Aniston dined two tables away from her ex-boyfriend John Mayer on April 17. Credit: George Pimentel/Getty Images; Christopher Polk/Getty Images

Of all the gin joints in all the towns in all the world. Jennifer Aniston and fiance Justin Theroux were enjoying a nice dinner with friends at West Hollywood's Sunset Tower on Wednesday, April 17, when they found themselves facing the dreaded ex factor: Aniston's former love John Mayer.

A witness confirms to Us Weekly that Mayer, 35 -- newly single since breaking up with singer Katy Perry in March -- arrived at the restaurant after the We're the Millers actress and her pals had already been seated. He and his friend were placed two tables away from the group, which also included Drew Barrymore, Chelsea Handler, and Handler's boyfriend Andre Balazs.

The exes did not appear to interact with each other, although Mayer took note of his ex-girlfriend's presence. Aniston, meanwhile, seemed to be having a great night with Theroux, whom she got engaged to last August after more than a year of dating.

The singer/songwriter first stepped out with the 44-year-old Friends alum in 2008. They called it quits that summer but later reconciled, only to break up again in 2009.

"[John and Jen] weren't right for each other, but he is really a good guy," a source told Us Weekly last year, adding that he wrote the song "Shadow Days" about her. "It really took him a long time to get over her. He really loved her a lot."