Liam Lindsay headed in a Preston winner in the 90th minute of the Lancashire derby at Blackburn to take them up to fourth in the Championship.
The defender popped up in the box to finish Ben Whiteman's cross and end a run of three consecutive away defeats.
Sammie Szmodics had earlier become the first Championship player to rack up double figures this season, his 10th of the campaign cancelling out a brilliant strike from Alan Browne that had given Preston a first-half lead.
Blackburn struck the bar twice in that first half, but Preston were always a threat on the break and themselves hit a post before Lindsay's late stooping header.
These two teams have been heading in different directions of late, with Preston seemingly fading after their pacesetting start to the season and Blackburn having won four of their previous five matches.
Preston were lifted by their first win in eight games, against Coventry last weekend, while Rovers have now lost five of their eight home games in the league this season.
Blackburn began on the front foot but Duane Holmes fluffed the first big chance at the other end, before Arnur Sigurdsson's side-foot volley from a precise Tyrhys Dolan cross thudded against the Preston bar.
But North End weathered the Rovers dominance and forged ahead after 35 minutes.
The ball was switched to Brad Potts on the right flank, and his instant cross-field ball found Browne's run. The Republic of Ireland midfielder controlled beautifully with the outside of his boot and then sent a rocket of a shot past keeper Leopold Wahlstedt.
Rovers again went close just before the break when Dolan neatly teed up Andrew Moran, whose rising drive clipped the bar and flew over.
Jon Dahl Tomasson's side were level within four minutes of the restart when Moran's pass found Szmodics, and he neatly slipped his shot through the legs of keeper Freddie Woodman.
Szmodics was denied by Woodman with a similar chance as Rovers pressed forward in search of a winner, but Holmes shot against a post and Milutin Osmajic had an effort disallowed for offside to remind the home side that Preston were a real threat on the break.
Blackburn's tendency to leak late goals struck again as the clock ticked down, with Whiteman crossing and Lindsay heading home - the 11th time this season Rovers have conceded in the final quarter of an hour.
Blackburn head coach Jon Dahl Tomasson told BBC Radio Lancashire:
"We're extremely disappointed to lose the game. I don't think we deserved to lose the game, if you look at our overall performance.
"We were the better team and created more chances than the opponent. We were probably lacking clear chances in the final third and runs in behind - when we did that, we created chances immediately.
"We should have done that better in the first half, but we still hit the bar twice in that first half."
On Szmodics: "He's doing great. He's one of the oldest boys, at 28, but he's also playing like a senior player, helping the team and scoring goals, working hard."
Preston manager Ryan Lowe told BBC Radio Lancashire:
"When you're winning derbies, you're always going to enjoy it. The lads were fantastic.
"We had to deal with large parts of their pressure, and how they play - they're a good footballing team, but we withstood all that.
"I'm disappointed with the goal [conceded] but the lads showed real character and desire, a never-say-die attitude, and to score the winner in front of our fans, in stoppage time, it probably can't get much better.
"We're a strong, resolute team that can overpower some teams, and I think we saw that with the [winning] goal. As long as they keep giving everything, we will win a lot of games."
On Browne's goal: "It's a fantastic goal. I see that on a daily basis in training. Pottsy can hit those balls and Browney can take those balls down out of the sky and finish them. Not just him, but other players in general.
"If there's a goal like that in the Premier League tomorrow, you'd be talking about it for weeks."