A controversial red card to central defender Daniel Ayala proved the turning point in a game that saw Preston North End steal three points from the Riverside.
Ayala paid the price for what appeared to be a good defensive challenge moments after the hour-mark when referee Keith Stroud produced a red card, and after scoring from the resultant free-kick, the visitors nicked the points late on against a Boro side who were down to 10 men.
Boro, who had controlled the game, had started like a train and were camped in the visitors' half of the field for the full opening 20 minutes, winning corner after corner in the process. Declan Rudd made a good early save from Jonny Howson and Lewis Wing had a shot deflected over the top.
John Obi Mikel came within a whisker of opening his account for the club when he struck the inside of the post after working an opening himself and Howson headed into side netting after meeting a George Friend ball at the back post.
Howson and Mo Besic were causing Preston all manner of problems, and it was the Bosnian who provided the ball for Ashley Fletcher, who peeled away before opening the scoring with a deflected shot past Rudd. It was Fletcher’s second successive goal.
The second half started with Boro seeking to double the advantage. Besic and Ryan Shotton combined well, but Britt Assombalonga was denied a header by some good defending. Ayala fired over the bar from the resultant corner.
Howson also had a chance after great work from Lewis Wing, but his effort was off target.
The game-changing moment came on 62 minutes, though, when referee Stroud saw something wrong with what appeared to be a terrific ball-winning challenge from Ayala on Brandon Barker, and the official brandished a straight red card in the face of the bemused Boro centre back.
It was from the resultant free-kick on the edge of the box that Paul Gallagher curled the ball beyond Randolph to double the injustice felt by Boro.
A huge double blow to Boro served as a boost for a Preston side who had not looked a threat for the opening hour. The visitors suddenly started to play with confidence, and their second goal came 10 minutes from time when substitute Jayden Stockley was able to head the ball home from close range.
Boro: Randolph, Shotton, Ayala, Flint, Howson, Besic (Hugill 77) Mikel (Tavernier 85), Wing, Friend, Fletcher, Assombalonga. Subs: Dimi, Clayton, Downing, Fry, Saville.
Preston North End: Rudd, Earl (Barker 46), Pearson, Davies, Browne (Rafferty 23), Johnson, Gallagher (Gallagher 75) Storey, Hughes, Maguire, Nmecha. Subs: Crowe, Ginnelly, Ledson, Huntington.
Referee: Keith Stroud
Attendance: 21,088 (411 Preston)