The Shakers dominated proceedings but were stunned by a 71st-minute winner by Andy Barcham for their League Two rivals.
The hosts started brightly and had a good chance in only the second minute when Andy Morrell saw a powerful left-foot shot deflected wide.
At the other end Gary Mulligan headed over at the near post from a John Nutter left-wing corner.
Ryan Cresswell saw a glancing header deflected wide for a corner as Bury pushed for the opener and, moments later, Alan Knill's side
thought they had the lead, only for Paul Scott's back-post header to be disallowed.
Elliott Bennett should have put the Shakers ahead when he fired over from the edge of the area before Creswell fluffed a good shooting opportunity.
Barcham forced a fine save from Wayne Brown from a powerful header as the visitors countered, before Andy Bishop twice went close for Bury
just before the break.
Bishop had a penalty appeal turned down shortly after the restart after a clash with Gillingham skipper Barry Fuller, before the striker teed up Morrell, but his strike partner saw his right-foot shot deflected wide.
Curtis Weston hit a curling left-foot free-kick straight at Brown, before the Gills hit on the counter-attack to snatch the winner.
Weston broke down the right and crossed for Barcham to head home, and Bury were unable to force a replay late on.
Tweet

