Following his 50th-minute introduction, Ainsworth teed up Sam Wood to level in the 76th minute after Stuart Lewis' shot had been blocked on the line by one of his team-mates.
Ainsworth again crossed from the right in the 81st minute for Matt McClure to thump in Wycombe's winner.
Ryan Jarvis fired Torquay ahead against the run of play in the 37th minute following a superb pass from Billy Bodin. Bodin cut inside before teeing up Jarvis to side foot home with the help of a deflection.
McClure had grazed the post from one of Wycombe's nine corners in the opening 33 minutes, but Jarvis' goal seemed to have the desired effect on Torquay, who went close through Bodin and top scorer Rene Howe either side of half-time.
However, Ainsworth's introduction turned the game around for the Chairboys, with Wood and McClure sealing all three points for their side.
The result means Torquay have now lost seven matches in a row, while Wycombe's win ended a three-match losing streak.