Jamie Foxx was on a fast track to blowing his career after he made the movie "Ray" ... and Oprah told him so and scared him straight.

The Academy Award-winning actor went on "The Howard Stern Show" and confessed he was drinking and partying way too much back in 2005 when Oprah staged what amounts to an intervention.

O called him and told Jamie straight-up he was ruining his career, saying, "All of this gallivanting and all this kind of s**t that's not what you want to do. I want to take you somewhere."

Jamie met Oprah at Quincy Jones' house after the call for a come-to-Jesus moment, where Sidney Poitier and other black Hollywood actors were on hand to push Jamie toward more sober and responsible living. Unclear whether he went to rehab, but whatever he did worked.

Jamie won the Best Actor Oscar award for "Ray."