A 31-year-old man who was sentenced to 20 years in prison in Baltimore after he pleaded guilty to possessing 5.9 grams of marijuana won an appeal Wednesday invalidating the plea — raising the possibility that he will be released.