Millwall were sent spinning to their fourth home defeat in the last five home league games as high-flying Middlesbrough secured all three points at The Den.
This was a real Jekyll and Hyde performance from The Lions, who were trailing 2-0 to a Marvin Emnes brace before Darius Henderson gave Kenny Jackett's men a glimmer of hope reducing the arrears a couple of minutes before the break.
But having withstood a second-half onslaught from the rejuvenated Lions, Boro sub Curtis Main killed the game with an 86th-minute cracker.
"In the first half we were poor and were deservedly behind," said Jackett, "but we got the goal before half-time, which is a great time to score, and I thought we could build on that in the second half.
We couldn't do it and then their third goal killed the game."
It was Boro who flew out of the traps and created two glorious opportunities in the first six minutes.
Lukas Jutkiewicz, who had already fired a whisker wide in the opening 60 seconds, was twice denied by the heroics of David Forde.
The Millwall keeper, back in the team in place of the injured Steve Mildenhall, somehow got a hand to both a looping shot and well placed header to thwart Jutkiewicz.
The best chance, however, fell to Emnes, who incredibly directed his header over the bar from barely two yards after Seb Hines had flicked on a Barry Robson corner.
But Boro got the goal they had threatened after 14 minutes when, from another inswinging corner by Robson, the ball was deflected into the path of Rhys Williams. His goalbound shot hit Emnes and flew past both Forde and a couple of Lions players on the line.
The Lions went close a couple of minutes later when a slick move involving Liam Trotter and Henderson ended with Boro keeper Jason Steele producing a fine save to deny Andy Keogh, although had Henderson, who was onside, taken the chance, Boro could have been in trouble.
Boro, who looked quicker and more mobile during the opening half, could have added to their tally but Forde gathered well from yet another Jutkiewicz header.
However, there was little Forde could do to prevent Boro adding a second goal seven minutes before half-time as the lively Emnes ran across Paul Robinson from the left flank and despatched a fine drive into the bottom corner.
At this stage the visitors were in complete control against a surprisingly lacklustre Lions.
However, striker Henderson handed Millwall a lifeline out of the blue three minutes before the break, stretching every sinew in his neck to send a looping header beyond the reach of Steele from six yards after Trotter had flicked on Scott Baron's deep free-kick.
That proved to be Barron's last contribution to the game, as he was one of two players replaced at the interval with Alan Dunne and Jimmy Abdou on for Barron and Josh Wright.
Jack Smith switched to left-back, with Dunne slotting in on the right and Keogh pushed further forward alongside Henderson as Millwall adopted a more direct style.
Roared on by the home fans, who did their best to inspire the team, the second-half performance proved unrecognisable from the first.
Having failed to muster a single corner, Jackett's men chalked up seven, but it was Boro left-back Joe Bennett who so nearly handed Millwall a second goal. Under no pressure at all, Bennett's woeful backpass was intercepted by Henderson, but Hines was on hand to intercept as the striker shaped to shoot.
A rampaging run by Dunne took the defender down the right flank, then into the danger zone as he picked his way past two defenders along the byeline. But a heavy second touch took the ball just out of reach and into the hands of keeper Steele, who then required lengthy treatment after colliding with Dunne.
WIth no sub keeper on the bench, Boro were relieved to see their stopper back on his feet once more, and he showed his mettle with an excellent block to keep out a stinging drive by Harry Kane.
Steele was then alert to keep out Liam Feeney's 20-yarder and from a Feeney corner, Henderson headed agonisingly wide, whilst skipper Robinson was inches away from getting on the end of another deep delivery from the left.
But with The Lions firmly in the driving seat and looking a good bet to grab an equaliser, Boro picked the perfect time to knock the stuffing out of them.
There were four minutes of normal time remaining when Julio Arca played in a low ball from the left down the line and Main, a 65th-minute replacement for Faris Haroun, controlled and hit a ferocious rising shot beyond Forde's reach and into the roof of the net.
Despite six minutes of injury time, that third goal effectively killed off The Lions.
Sub James Henry was denied with a low drive well held by Steele and Shane Lowry's shot was also saved by the keeper as Boro held on to their two-goal cushion and three points.
Millwall: Forde, Smith, Robinson, Lowry, Barron (Dunne, 46mins), Feeney (Henry, 85mins), Wright (Abdou, 46mins), Trotter, Keogh, Henderson, Kane. Subs not used: Allsop, N'Guessan.
Bookings: Henderson (26mins), Wright (45+1min), Trotter (84mins), Abdou (85mins)
Scorer: Henderson (42mins)
Middlesbrough: Steele, Hoyte, Bates, Hines, Bennett, Robson (McMahon, 87mins), Williams, Haroun (Main, 65mins), Arca, Jutkiewicz, Emnes (Smallwood, 82mins). Subs not used: Martin, Ogbeche.
Bookings: Williams (52mins), Bates (54mins)
Scorers: Emnes (14, 37mins), Main (86mins)
Ref: J. Linington
Att: 9,286 (away 547)