Bury won away from home for the first time this season in League One, beating Oldham in the Greater Manchester derby.
The visitors went ahead when Latics' Cliff Byrne headed Matt Doherty's cross against James Tarkowski, who could only watch the ball sail into his own net.
Steven Schumacher's penalty, after Tarkowski fouled David Worrall in the area, sealed a crucial three points for the struggling Shakers.
Robbie Simpson's stoppage-time header was a late consolation for Oldham.
It was a night of huge frustration for the Latics, who had lost only one of their previous seven matches but were second best to a side that had previously been without an away win in League One since 21 April.
Oldham were wasteful in possession in the early stages, while the Shakers looked more confident on the slippery Boundary Park surface and it was no surprise when Kevin Blackwell's men took the lead, albeit in bizarre circumstances.
The impressive Doherty made a surging run from right-back and, while Byrne was able to meet the Dubliner's cross, his clearing header bounced off fellow defender Tarkowski and past a helpless Dean Bouzanis.
Robbie Simpson's tame effort from the edge of the box was all Oldham could muster from a forgettable first 45 minutes for the home side.
Captain Dean Furman was introduced just before half-time and the hosts improved significantly after the break.
Simpson's lobbed effort from 25 yards landed on the roof of the net, while an unmarked Jonathan Grounds nodded wide from a corner.
And Bury keeper Trevor Carson was forced into his first meaningful action of the evening to keep out Jose Baxter's drilled volley.
The visitors held firm against a barrage of set-pieces and made the game safe with four minutes left.
Referee Graham Salisbury, having turned down an earlier penalty appeal from Furman, pointed to the spot after Tarkowski was caught in a tangle of legs with Worrall. Bury skipper Schumacher lashed the resulting penalty high past Bouzanis to double the lead.
Simpson's late header from a Lee Croft free-kick frayed a few Bury nerves in injury time, but the League One strugglers held on for the win and extended their unbeaten run in all competitions to four matches.
VIEW FROM THE DRESSING ROOM
Oldham Athletic manager Paul Dickov told BBC Radio Manchester:
"They started the game brighter than us, they played with more energy and they played the better football in the first half.
"The standards we've set, with or without the ball, weren't there, especially in the first half.
"The boys had a go in the second half, which is the minimum we should ask from them. Two massive decisions have cost us.
"How the penalty for Dean Furman is not given, I'll never know. He's had his legs wiped from under him, right in front of the referee."
Bury manager Kevin Blackwell told BBC Radio Manchester:
"It's always nice to win a local derby.
"Oldham put us under pressure towards the end, but in the first half and in short spells of the second half, we looked a good side.
"Knowing Paul Dickov's side, they're always at you and they never give up. I wouldn't expect a team to lie back and die, and sure enough they didn't.
"Sometimes you have to fight and scrap, and sometimes you can play like Barcelona. We did a bit of Barcelona and a bit of Bognor Regis."