Stock's 18-yard effort bobbled through a crowd of players and squirmed out of goalkeeper Jason Steele's grasp to hand the South Yorkshire club a first win over Boro since 1957, the year their manager Sean O'Driscoll was born.
Stock rising: Doncaster skipper Brian Stock strikes home an injury-time winner for the hosts to condemn Middlesbrough to defeat
O'Driscoll, who is on managerless Sheffield United's radar, saw his side rise to ninth in the Championship.
Boro, just one place above the relegation zone, led after four minutes when Marvin Emnes beat the offside trap and teed up Scott McDonald, who flicked in from six yards.
Early doors: Scott McDonald's goal gave Middlesbrough the lead but it did not last long
But James Hayter's near-post header levelled matters after 22 minutes.
Boro manager Tony Mowbray said: 'We would have been disappointed with a draw, to be fair.'
Sinking feeling: Doncaster celebrated their first win over struggling Boro since 1957
Sean O'Driscoll happy to be a contender for Sheffield UnitedBurnley manager Brian Laws hopeful of keeping starlet Jay RodriguezPortsmouth seek to head off Blackpool and Wigan by offering new deal to David Nugent
Explore more:People: Sean O'Driscoll, Tony Mowbray, Brian Stock, James Hayter