Lee, sent off in the reverse fixture in September, converted from close range to end the Kent side's run of three successive defeats.
Unbeaten in six games, the visitors had the best of the chances throughout this end-to-end encounter.
Billy Clarke volleyed across the face of the goal from Mike Jones's cross after seven minutes and also headed wide from six yards shortly before Lee's decisive strike.
Top scorer Matt Tubbs came within inches of diverting Jamie Proctor's deflected shot into the goal shortly before the break and Gillingham midfielder Steven Gregory diverted Joe Walsh's header on to the post.
The Gills had earlier come close to breaking the deadlock when Paul Jones produced a sprawling save to deny Cody McDonald.
Gills' on-loan striker Joe Pigott blazed over from 10 yards following Jones's parry and Craig Fagan's low drive was well saved by the visitors' goalkeeper.