The 37-year-old former QPR ace secured the points with a bullet header from a Chris Westwood cross in the 58th minute to cap a stirring fight back from the promotion hopefuls.
It's now just one away defeat all season for the Chairboys who trailed to a brilliant curling free kick from Cheltenham left-back Danny Andrew on 12 minutes.
But Wycombe owed a huge debt to keeper Nikki Bull who made a string of saves - starting with a superb double stop to deny Wesley Thomas and Jeff Goulding respectively.
The Chairboys hit back just before the interval with an individual effort from Stuart Beavon who twisted and turned before lashing in a left foot shot past Scott Brown.
Ainsworth's fifth goal of the season put the visitors ahead but the Robins had opportunities to level with Brian Smikle twice close to snatching an equaliser while Wesley Thomas headed agonisingly wide in the last minute.
Source: PA
Source: PA