When a male contestant stepped onto the stage at the Oracle Arena, "You could see that Britney recognized him straight away," a source tells PEOPLE. "She got this huge smile on her face and her eyes lit up. It was so sweet."
"I know him," said Britney, who was sitting on the panel with Simon Cowell, L.A. Reid and Demi Lovato. "We did a duet together 10 years ago."
When the singer started to cry and told the judges and the audience, "I'm gay," the audition became emotionally charged.
"At the time I didn't think I was worthy," he told Britney. "I didn't think you thought it was okay that I am gay."
Britney was nothing but supportive. "I think it is fine you are gay," she said.
"When he started crying and saying he thought he'd never see her again and that he'd had a lot to deal with, Britney was comforting him to calm him," the source says.
But during his audition, Britney was visibly shaken.
"She's been through a lot in those 10 years, too, so it must have been a shock for her to see him," the source says. "You could tell she was emotional and she really felt for him especially when he was crying, but she also stayed calm."
In the end, Britney gave the singer a typically straightforward critique.
"She handled it unbelievably well and really stepped up to the situation," says the source, who would not confirm the identity of the singer or whether he made it through the audition. "It was probably the most personal and emotional situation for her that's happened so far on X Factor, and she took it totally in stride in front of a live audience of thousands."
Reporting by JAMIE FROEHLING and MARISA LAUDADIO