Preston North End's play-off push gathered further pace as they staged a second-half comeback to beat Middlesbrough at the Riverside Stadium.
The Lilywhites were dreadful in the first half and were fortunate to only trail at the interval to Ashley Fletcher's deflected goal.
But they turned things round dramatically, a red card for Boro defender Dani Ayala just after the hour mark the signal for the fightback to start.
Ayala walked for a two-footed challenge on PNE substitute Brandon Barker and from the resulting free-kick, Paul Gallagher curled home his 100th career goal for the equaliser.
Against the hosts 10 men, North End went for the throat and scored their winner nine minutes from time.
It was scored by Jayden Stockley, the substitute the first to react when Andrew Hughes' shot hit a defender and looped into the air, the January signing from Exeter heading over Boro keeper Darren Randolph.
For Preston, this was their first league win over Boro since April 1972.
At the interval, you would not have imagined this result possible, with North End looking totally out of sorts in a 3-5-2 system which matched up that of their hosts.
They looked better for the change back to 4-1-4-1 and were rewarded with a sixth successive away win.
North End's side had shown two changes, Ben Pearson returning after suspension to take the place of Ryan Ledson in midfield and Josh Earl was drafted into the defence in the absence of the banned Darnell Fisher.
They were put under pressure by Boro from the kick-off and didn't look comfortable.
Mo Besic's early run through midfield carried him into the box, his toe-poked shot blocked by Ben Davies coming across.
Declan Rudd was tested in the sixth minute, diving to his right to push a 20-yard shot from Jonny Howson behind.
The resulting corner dropped to Dani Ayala at the far post, his shot on the stretch clipping the outside of the post and going behind.
Boro struck the woodwork a second time when John Obi Mikel's shot hit the foot of the near post and bounced across goal, Davies clearing the danger.
North End lost the services of Alan Browne to an ankle injury with only 22 minutes played, the Irishman having soldiered after being fouled by Besic a couple of minutes earlier.
Joe Rafferty replaced him, taking Browne's place in the right wing-back role.
Just as it was looking like they were settling down a bit, PNE fell behind in the 32nd minute - the goal having a touch of fortune about it.
Besic's run through midfield was not tracked, the on-loan Everton man sliding a pass into the box to find Fletcher.
He took a touch before getting a low shot away which clipped off Jordan Storey's foot and beat Rudd.
That was the cue for a change of formation, North End going back to a 4-1-4-1 which had served well in recent weeks.
Twice in the run-up to the interval, Rudd was called into action to ensure the deficit stayed at one goal.
He dived in the six-yard box to parry Howson's low shot, then in stoppage-time was off his line quickly to block from Britt Assombalonga who had got clear in the box.
Barker was PNE's second substitution at the start of the second half, replacing Earl and he was to make a big difference.
It was a challenge on Barker which was to lead to Preston scoring their equaliser in the 63rd minute.
The Manchester City loanee ran on to a pass from Sean Maguire, his run halted two yards outside the box by Ayala's challenge.
It was made with both feet, referee Keith Stroud viewing it as out of control and reckless, awarding a free-kick before pulling out the red card.
Gallagher knocked the free-kick to Hughes, took the return pass and curled a beauty of a right-foot shot into the far bottom corner.
That goal injected some confidence into North End, Pearson seeing a shot from 20 yards deflect off a Boro player and go straight at the keeper.
They turned the game completely on its head in the 81st when they took the lead.
Hughes had a shot from 25 yards which looped off a Boro player and looped up into the air, Stockley - on for Gallagher - the first to react and loop a header over the stranded Darren Randolph.
Boro: Randolph, Shotton, Ayala, Flint, Howson, Mikel (Tavernier 85), Besic (Hugill 76), Wing, Friend, Fletcher (Fry 64), Assombalonga. Subs (not used): Clayton, Downing, Saville, Dimi.
PNE: Rudd, Storey, Davies, Hughes, Browne (Rafferty 22), Pearson, Johnson, Gallagher (Stockley 75), Earl (Barker 46), Nmecha, Maguire. Subs (not used): Ginnelly, Ledson, Huntington, Crowe.
Referee: Keith Stroud (Hampshire)