The big Bristol Rovers striker, who notched a double to end a six-game scoring drought, made room for himself inside the box to fire past Scott Brown from ten yards five minutes from time.
It spelled heartbreak for Cheltenham, who had led twice and contributed fully to a cut-and-thrust match played mainly in pouring rain.
Ashley Vincent fired the visitors in front on 11 minutes with a cool right-footed finish after the ball had rebounded to him off Lloyd Owusu just inside the box.
But Lambert equalised ten minutes later, sliding in at the near post to convert David Pipe's low cross from the right.
Cheltenham were back in front five minutes after the break when Owusu exchanged passes with Josh Low before beating Steve Phillips with a chip into the roof of the net from 12 yards.
Rovers improved after introducing substitutes Craig Disley and Darryl Duffy just before the hour mark and Disley soon headed against a post from another Pipe cross.
But there were 84 minutes on the clock before Duffy equalised for the home side, volleying the rebound after Brown had saved brilliantly from Lambert's header.
Within a minute, the home side were in front and battling Cheltenham had nothing left in the locker to conjure up a fightback.
Martin Allen's team had the elements in their favour in the first half and just about edged the game, but Rovers came on strong after the break and could claim to be worth their victory.
Lambert and Owusu did excellent jobs as targetmen for their respective teams and Pipe's recall in place of Disley on Rovers' right flank increased their attacking potency.