Sean Maguire was Preston North End's match winner against Bristol City as he came off the bench for the second game running to find the net.
Maguire scored within seven minutes of joining the action, running on to a through ball from fellow sub Daniel Johnson to fire home.
His goal came soon after Famara Diedhiou had headed the Robins level, Alan Browne having given North End the lead in the first half.
The visitors finished the game with 10 men, centre-half Aden Flint getting a straight red card for swiping out at Greg Cunningham seconds into stoppage-time.
It was a hard-fought three points, PNE pushed all the way in the second half by City.
They had been full value for their half-time lead though, Browne finding the net with a finely executed chip over the stranded City goalkeeper after a defensive mix-up.
Victory moved Alex Neil's side up to eighth place and closed the gap on the play-off places to a single point.
The North End side had shown just the one change to the one which started the Gentry Day win at Bolton, Darnell Fisher returning from suspension to replace Calum Woods at right-back.
An early chance fell the way of Billy Bodin, the former Bristol Rovers man cutting into the box on to his left foot and seeing his shot blocked.
When Paul Gallagher's free-kick from the right channel was cleared out of the box, Browne got to the loose ball 20 yards and drove a left-foot shot high over the bar.
The visitors' first sight of goal was a Magnusson daisy-cutter from the left side of the box which Declan Rudd dived to save comfortably.
Rudd then had to race to the edge of his box to kick clear from Diedhiou as the striker chased a ball over the top of the Preston defence.
North End went in front in the 20th minute and in some style too.
Bodin hooked the ball forward down the right channel, the ball looking to be running through to keeper Frank Fielding as he came towards the edge of his box.
However, Magnusson chose to intervene, the Iceland international's clearance falling into the path of Browne 25 yards out who chipped it over the out-of-position Fielding and into the net.
PNE weren't far away from a second goal when Gallagher rolled a free-kick down the right-wing for Fisher to chase, his cross into the box met by Paul Huntington with a header - one which was cleared for a corner.
Fisher then had a shot blocked on the edge of the box after coming inside off the right.
The Robins made a busy start to the second half, Jamie Paterson breaking away down the right and putting over a cross which Fisher did well to clear out of the six-yard box on the stretch and behind for a corner.
North End cleared the first flag kick for another corner and when that was played in, Magnusson sent a header bouncing off the turf which Rudd helped over the bar.
In the 54th minute Gallagher delivered a free-kick from out on the left-wing into the box, Cunningham meeting it with a flicked back header which Fielding superbly tipped around the post.
Gallagher was substituted just before the hour, replaced by Daniel Johnson as Alex Neil sough to freshen up the midfield.
Maguire joined the action in the 63rd minute, taking over from Bodin as he had done at Bolton - Maguire went up front with Callum Robinson moving to the left and Tom Barkhuizen switching wings to the right.
The visitors levelled in the 67th minute, Bobby Reid getting the ball on the left and as Fisher stood off him a fraction too long, he sent over a cross which Diedhiou headed over Rudd from eight yards.
Parity lasted less than two minutes though as Maguire made an instant impact.
Johnson's through ball sent the Irishman racing clear on goal, Maguire taking the ball past Korey Smith and holding off Flint before shooting low left-footed past Fielding from 12 yards.
North End lived dangerously after the goal, Paterson shooting into the side-netting after Browne had given the ball away in midfield, allowing City to counter-attack.
Rudd then produced a fantastic save at point-blank range to keep out Reid's close-range volley after Josh Brownhill's cross had found reached him.
In the 85th minute, Johnson broke-up a City attack and played the ball out to Robinson on the left.
Robinson sent a right-foot cross curling into the box which Barkhuizen met on the stretch and volleyed over the bar.
There was drama in the 90th minute when City's centre-half Flint was sent-off.
It happened after a cross had dropped just wide of the PNE goal, Flint flinging an arm at Cunningham after they had got up off the floor.
North End saw out six minutes stoppage-time, having to defend a needlessly given away corner right at the death - City sending keeper Fielding up.
PNE: Rudd, Fisher, Huntington, Davies, Cunningham, Pearson, Gallagher (Johnson 59), Bodin (Maguire 63), Browne, Barkhuizen, Robinson (Woods 90). Subs (not used): Spurr, Harrop, Moult, Maxwell.
City: Fielding, Wright, Flint, Magnusson (Kent 64), Bryan, Brownhill, Pack, Smith, Paterson, Diedhiou, Reid. Subs (not used): Pisano, Walsh, Eliasson, O'Neil, Diony, Steele.
Referee: Geoff Eltringham (County Durham)
Attendance: 11,264 (405 away)