Bury claimed a surprise victory over League One side Crewe to advance to the second round of the Capital One Cup.
The Alex had made the breakthrough when Arsenal loanee Chuks Aneke converted from AJ Leitch-Smith's cut back.
But Shaun Beeley's drive levelled matters, before Shaun Harrad's penalty put the League One side ahead after Anthony Grant fouled Richard Hinds.
Hinds poked the hosts further ahead, before the Alex's Harry Davis's penalty proved little more than consolation.
Davis scored from the spot after Gareth Roberts had brought down Ryan Colclough, but the Shakers held on for victory.