The centre-half, on loan from Reading, was left unmarked to head home a Billy Jones corner midway through the second half as the Robins continued their push for automatic promotion.
With Port Vale sharing the points at Rochdale, a draw would have been enough to see the visitors crowned champions.
And it looked like finishing all square for much of the game as the sides traded blows in midfield.
Cheltenham skipper Russ Penn stabbed a shot just wide on the half-hour with Jason Thomas forcing a good save from Gills goalkeeper Stuart Nelson soon after.
The visitors' best effort before the break fell to leading scorer Danny Kedwell but his header was turned over the crossbar by Robins `keeper Scott Brown.
The home side had the pick of the second-half efforts with Kaid Mohamed having a shot deflected just over the bar moments before Hector scored from the resulting corner.
Adam Barrett and Chris Whelpdale went close late on but there were to be no title celebrations for Allen's side.
- Sports & Recreation