Jason "Gummi Bear" Davis just dodged a three-year jail stint -- because TMZ has learned, his laundry list of drug charges were dismissed this week ... including felony heroin possession.
Jason -- grandson of oil mogul Marvin Davis -- struck a sweet deal with prosecutors to get off the hook ... agreeing to complete a drug diversion program if they dropped the charges. He completed the program this week, so prosecutors held up their end of the bargain.
As we previously reported, Jason was arrested back in January for possession of a controlled substance ... and was subsequently charged with heroin possession, being under the influence of a controlled substance, and possession of drug paraphernalia.
Jason pled "not guilty" to the charges in April -- but lucky for him, none of that matters now.