Mike Grella scored twice as 10-man Bury dented Notts County's League One play-off hopes with victory at Meadow Lane.
David Worrall fired the Shakers ahead from 25 yards but the Magpies levelled when Giles Coke turned Alan Judge's cross into his own net.
Grella chipped Stuart Nelson to put Bury back in front and then netted with a deflected shot for 3-1.
Mike Edwards headed in to pull one back but Mark Carrington made it safe for Bury after Andrai Jones was sent off.
Bury's victory confirmed their League One status for another season by ensuring that fourth-from-bottom Wycombe can no longer overhaul them.
VIEWS FROM THE DRESSING ROOM
Bury manager Richie Barker told BBC Radio Manchester:
"To come away to a team that's in the play-offs and win 4-2 is excellent.
"It's as good an all-round performance as we've had for a while.
"The momentum we'll get from the end of the season will continue at the beginning of next season.
"It's frustrating because if we'd have started this run two or three weeks earlier, we might have been looking up instead of down."