Thomas was hit with charges of marijuana possession and speeding and was facing up to 6 MONTHS in jail if he was convicted on the weed charge.
But, according to court docs obtained by TMZ Sports, Thomas cut a deal with prosecutors earlier this month and entered into a pretrial diversion program to close out the case.
The docs say as part of the program, Thomas had to pay $899 in fines and fees and also comply with the NFL's Drug and Alcohol Treatment Program and successfully complete all of the league's recommendations.
Also, as part of the agreement, Thomas had to admit to both possessing the weed and speeding.
It turned out to be a solid deal for the receiver ... because just a few days after reaching the agreement, Kansas City resigned him to their preseason roster and is giving him a shot to make their final 53-man squad this weekend.
Thomas -- a Chiefs' fourth-round pick in 2014 -- has been a solid contributor for KC the past five seasons, playing in 55 games.