Boro went into the game after four wins on the bounce but put in a lacklustre display as the Lions grabbed three precious points to climb out of the relegation places.
Twice Maierhofer took advantage of poor defending to head home in the first half before Emmanuel Ledesma clawed one back with a free-kick after the break.
Boro almost drew first blood in the sixth minute. Grant Leadbitter flicked inside to Danny Graham who nodded it back then peeled off towards the box and when Leadbitter played it into his feet the striker stabbed a long shot that sent keeper David Forde full length to push it onto the post.
Millwall built up a head of steam as crosses from Lee Martin on the left caused trouble in the Boro defence and first Alan Dunne headed wide then Maierhofer put one into the side netting.
And the pressure told on 16 minutes as Martin curled another cross to the far post for the unmarked Maierhofer to power home.
Boro had chances to level but Millwall goalkeeper Forde first blocked a Jacob Butterfield shot from inside the box then dived to smother a downward header by Graham.
But Millwall got a carbon copy second goal on 30 minutes as Martin crossed from the left to the far post where Maierhofer stooped to head home.
Boro stepped up a gear after the break and had plenty of possession without troubling the Millwall keeper.
Millwall had a golden chance to seal it with a third as they broke out on 72 minutes.
Alan Dunne knocked a long ball forward out of defence to send substitute striker Steve Morison storming forward with defenders in pursuit – but his low shot from 20 yards was easily saved by Dimi Konstantopoulos.
And they went closer still a minute later as Dunne sent Morison surging down the right and when he cut it back into the box Martyn Woolford stabbed it goalwards but Konstantopoulos went full length to push it away at the far post.
Boro clawed a goal back on 79 minutes as Graham was fouled on the edge on the edge of the box and Ledesma chipped over the wall and under the bar.
Millwall almost had a third in stoppage time as former Boro striker Scott McDonald drilled in a low 20-yard shot that Konstantopoulos blocked and Lee Martin poked home the rebound but the offside flag was already up.