Justin Hoyte's magical opener was witnessed by 28,229 fans on Teesside, the right-back racing onto Emmanuel Ledesma's through-ball before curling the ball into the top of the net with his laces.
However, Wednesday were level courtesy of a controversial equaliser from Gary Madine.
There was a hint of offside as Jay Bothroyd picked out Michail Antonio in the box, the ex-Reading man chesting the ball down for Madine to tuck it away. Boro boss Tony Mowbray remonstrated with the fourth official but the goal was given. Even Madine looked across to the linesman for confirmation before celebrating.
Boro were back in front, though, as Ishmael Miller stole in to tap the ball home after Scott McDonald had collected Ledesma's pass and sent it bobbling towards goal.
And second-half substitute Lukas Jutkiewicz headed home from a corner to ensure the hosts edged above Crystal Palace, who must wait until Saturday's game at Peterborough to try and reclaim top spot.