Cody McDonald scored two late goals to keep Gillingham's promotion pursuit alive as they won at Cheltenham.
The hosts took an early lead when Steve Elliott thumped home Danny Andrew's cross from close range after the Gills failed to clear a corner.
McDonald equalised on the rebound after his looped header had hit the crossbar.
In the 90th minute Adebayo Akinfenwa got behind the Robins' defence and put in a pin-point cross for McDonald to head the winner.
Cheltenham Town boss Mark Yates told BBC Radio Gloucestershire:
"We didn't deserve that, but that's just the way it's going for us at the minute.
"We tried to play, particularly in the first-half. It is a real kick in the teeth, but sometimes that happens and you've got to deal with it.
"I'm proud of my boys, we haven't been as competitive as I would have liked at games but we stuck at it.
"The defenders pride themselves on trying to keep goals out and I feel for them, but there's no point feeling sorry for ourselves. It was better and we've got to continue to be better for the next seven games."
Gillingham striker Cody McDonald told BBC Radio Kent:
"We left that a bit late for our own good but we'll take that. Thankfully I scored a couple of goals but the the character of the boys is just unbelievable - at the moment they just don't know when they're beaten.
"If we just keep on putting performances in like we did for the last hour, if we can come back and win like that then we'll be all right.
"We know that we should be starting better but once again the boys have shown what it's all about at this club. That result out there will give us great confidence, not that we need it at the minute. It will give us a massive boost going into next Saturday."