Matt McClure hit his ninth goal of the campaign as Wycombe denied Gillingham a return to the top on League Two.
After wasting a one-on-one chance, the substitute broke the deadlock from 10 yards as improving Wycombe earned a sixth away win of their campaign.
Gillingham keeper Stuart Nelson was in inspired form, saving from Sam Wood's curling effort before the break.
The hosts threatened as Dave Winfield cleared Myles Weston's shot off the line before McClure clinched the match.
In injury time, Wycombe goalkeeper Jordan Archer was attacked by a supporter after being booked for time wasting.