The singer was answering questions regarding photographer Jeffrey Binion. The pop star is accused of ordering his bodyguard Hugo Hesny to choke Binion and take his camera equipment outside a recording studio in June.
When the line of questions turned to Gomez, Bieber got so upset he stormed out of the room. According to TMZ.com, the photographer's lawyer asked if Gomez was present during the incident, and Bieber jumped up and left, yelling "Don't ask me about her, do not ask me about her!"
Bieber took a few minutes to calm down before returning to the deposition, and he was obviously agitated.
He responded to a question by saying, "Yeah", and the lawyer asked, "Do you mean yes?", to which Bieber remarked, "What the f**k is the difference between yeah and yes?!"
Bieber continued to be sarcastic with quips such as: "What is this, '60 Minutes?'" and later, "OK Katie Couric, what's your question again?"
Bieber obviously still has feelings for Gomez. Earlier this week, he posted a photo of her from the Vanity Fair post-Oscar party and called her the "most elegant princess in the world."
Meanwhile, a judge ruled on Tuesday that jail footage of the singer must be edited before it is made public. Bieber was arrested in January for DUI, resisting arrest and driving with an expired license after being pulled over for allegedly drag racing and speeding.
His attorneys didn't want clips of the star giving a urine test to be released to the public. The video was released, but it features giant black boxes over the singer's private parts as he goes to the urinal.