Shaquille O'Neal indirectly won an enormous victory today ... after a judge threw out a case against 7 gang members who were accused of kidnapping a man in order to retrieve a sex tape of Shaq.

Robert Ross -- the alleged victim -- claimed he had a sex tape showing Shaq with multiple women at different times while he was still married to Shaunie O'Neal.

Ross claimed 7 gang members kidnapped him at the direction of Shaq and tried to beat him into submission so he would cough up the video.

Today in court -- in the middle of the preliminary hearing -- the D.A. shocked the courtroom, stating they no longer had confidence in Ross based on his testimony and his actions outside of court.

Lawyers for the 7 defendants asked the judge to immediately dismiss the case -- which is exactly what the judge did.