The jury in the case -- in which prosecutors argued Stern and others conspired to fuel Anna Nicole Smith's drug habit -- found Stern guilty of 2 counts of conspiracy, but not guilty on 7 other charges.
The judge felt the conviction was baseless and threw it out.
It's also a major repudiation of California Gov. Jerry Brown who grandstanded and spent millions as Attorney General going after Stern and the other defendants.
The judge also found that psychiatrist Khristine Eroshevich was acting out of concern for Smith -- and sentenced her to no more than one year of probation and a $100 fine for obtaining a Vicodin prescription under a false name.
UPDATE: District Attorney Steve Cooley says, "We strongly disagree with Judge Robert Perry's ruling today," adding, "[the ruling] diminishes the huge social problem of prescription drug abuse facilitated by irresponsible caretakers and unscrupulous medical professionals."
Cooley says he'll appeal the ruling and hasn't decided whether to retry Stern on the charges on which the jury was hung.