He's out on bail facing 20 years in prison -- but ex-"Smallville" actor Sam Jones still needs to work ... which is why an LA court granted him permission to party in Mexico this week with his Playmate GF.
Sources close to the actor tell TMZ, Sam was paid to appear at Dady'O Nightclub in Cancun Thursday night -- alongside his GF Karissa Shannon and her twin sis Kristina -- and in Hollywood ... that counts as a real job.
But Sam couldn't just hop a plane and fly south of the border ... the guy is awaiting sentencing for his massive drug trafficking case -- scheduled for June -- and technically isn't allowed to leave the country.
So he did what any other actor in his position would do -- he filed papers with the federal court in L.A. asking for a special dispensation ... on the grounds that he needed the money ... and the court actually GRANTED it.
FYI -- the photo above is from the actual event. Celebrity justice at its finest.