Sam Baldock scored twice for Bristol City against 10-man Peterborough as they recorded their first win at Ashton Gate since August.
Paul Anderson opened the scoring for the home side, before Lee Tomlin was sent off for Posh after 12 minutes.
The visitors equalised through Grant McCann, before Baldock netted his first of the afternoon.
A Stephen McManus header and Baldock's second made it 4-1, before Dwight Gayle scored a consolation.
The win ended a nine-game winless streak for City and sees them leapfrog Darren Ferguson's side in the bottom three.
They now sit level on points; three from safety.
Anderson, who replaced Liam Fontaine for the home side, needed just five minutes to repay the manager's faith when he headed home a cross from Baldock.
Despite Tomlin being sent off for an elbow on Greg Cunningham, the 10 men were gifted an equaliser when City goalkeeper Tom Heaton fouled George Boyd.
McCann made no mistake to score his second of the season but the parity did not last long.
Baldock scored his first goal from open play in 16 matches, before McManus made sure of the victory.
Baldock doubled his tally from the penalty spot after Anderson was fouled by Michael Bostwick.
Jon Stead and Steven Davies both hit the bar for City, before Gayle slid in to score a late consolation from close range.
Bristol City manager Derek McInnes: "We owed our home fans a big performance and that's what we gave them.
"We were the better team, apart from a five- or ten-minute spell after the sending-off, which seemed to affect us more than them.
"It was a huge result for us and one we must use as a springboard. I'm certain we have what it takes to get out of trouble in the new year."
Peterborough boss Darren Ferguson: "I'm not going to blame the sending-off of Lee Tomlin for our defeat. We cannot start games as poorly as that and expect to get anything.
"Bristol started really brightly and it was the goals we conceded, rather than the red card, which cost us.
"The two in the second half were soft and put us out of the game. We must now brush ourselves down quickly for a really big game against Barnsley."