Bury manager David Flitcroft admitted the Shakers were fortunate to win 2-1 at home to Bristol Rovers and move to the brink of League 2 survival.
Hallam Hope gave Bury a dream start by firing in a third-minute opener, only for Rovers to equalise on the stroke of half-time as Ollie Clarke's shot deflected in off team-mate Kaid Mohamed.
But with his very first touch, substitute Tom Soares headed home in the 80th minute to send the Shakers into the top half, 10 points clear of the bottom two with six games left.
"We maybe didn't deserve to win, they'll consider themselves unfortunate," said Flitcroft. "But during my time here I believe we deserve to be 12th.
"The first 35 minutes I was pleased with how we went about our business. We pressed them well and created some good chances.
"But they dominated the last 10 minutes before half-time and for 20 minutes in the second half we couldn't get near them. We swapped things around and got the last 20 minutes right.
"We stood firm at the start of the second half and that's what won us the game because it allowed us to go on and get the winner.
"That's as good a team as we've played here. They played with purpose and mixed things up but we coped with it.
"To get the victory is incredibly pleasing because the work we've had to put in to keep this team in this league has been relentless."
There seemed little on when the ball looped to Hope just inside the right corner of the box but the Everton loanee brought it down on his thigh before smashing a half-volley inside the far post.
Brian Jensen then denied John-Joe O'Toole but moments later Mohamed's deflection left the veteran keeper stranded.
Jensen had to pull off a superb save to keep out Matt Harrold's header before Michael Smith and Harrold spurned decent openings in the second half.
But Bury replied with Danny Nardiello going close before Soares claimed the winner from Chris Hussey's corner to leave the Pirates in 20th place.
"I thought it was a bit undeserved," said Rovers boss Darrell Clarke.
"For the first 20 minutes we were all over the shop.
"But then we grew into it, we deservedly got level and at the start of the second half I thought only one team was going to go on and win it.
"Fair play to Bury, they came back at us and I thought we'd weathered the storm but then we conceded from a set-piece, which is disappointing from our point of view.
"There's a couple of lads at the near post who should be dealing with the ball and they didn't, which is unacceptable really at our level.
"The boys will learn from that but they've got to learn quick because we've only got six left. We had a positive result on Saturday and we've got to keep going."