Notts were in the ascendancy at half time having held on to a lead given to them as early as the second minute which for a while shook Boro out of their stride.
Tony Scully, whose selection was a surprise, proved inspirational and never more so than when he claimed the early goal with an angled drive that took a deflection of Ugo Ehiogu before beating Mark Schwarzer.
Boro had more of the possession in the first 45 minutes without seriously testing Notts' in-form young goalkeeper Saul Deeney, who had not conceded a goal in the three previous matches.
But behind at the break, then came McClaren's master stroke. He replaced wide player James Morrison with another youngster, Daniel Graham, and went to a diamond formation that gave midfielders Doriva and Ray Parlour plenty of space with which to become a growing influence on the game.
It was from a strike by Michael Reiziger that Middlesbrough levelled nine minutes into the second half.
Deeney could do no better that palm his effort away and the ball fell invitingly to the feet of Doriva who blasted it into the net from the edge of the penalty area.
After this Middlesbrough began to take an increasing grip on the game, but when their winner came it was simplicity itself.
Stewart Downing floated a free-kick into the path of the unmarked Joseph-Desire Job who coolly slid the ball home.
Middlesbrough deserved to go through and Notts were thankful to Matthew Gill and Kelvin Wilson for heroic goalline clearances.
But late substitute Stefan Oakes almost gave Notts a replay at the Riverside when he cracked a free-kick just over the angle and then delivered a corner in stoppage time which Boro only just scrambled clear.
MANOF THE MATCH: Doriva (Middlesbrough) Scored a cracker of a goal and caught the eye with an all-round superb midfield display.