Rovers had hit the front in the 90th minute after Charlie Mulgrew scored his second goal of the game.
But Roofe smashed home a minute later after Raya Martin palmed a save in his direction and wrapped up a stunning win four minutes into added time, heading home to give United their seventh win in a row.
Mulgrew had earlier cancelled out a Derrick Williams own goal from the penalty spot.
Leeds had created enough chances to win the game more comfortably with Ezgjan Alioski hitting the crossbar in the first half and Martin was called upon to make a number of smart saves.
Pablo Hernandez had a shot blocked by Ryan Nyambe after four minutes as the home side started positively.
Luke Ayling fired a powerful shot just wide from distance on 12 minutes as Leeds continued to push.
Bradley Dack was denied an opener for Rovers a minute later following a foul on Barry Douglas in the build-up.
Jack Rodwell drove a first-time effort just wide for the visitors after 19 minutes, before Danny Graham fired over a minute later.
Martin did well to smoother at Roofe’s feet after he went through on goal after 23 minutes.
Raya palmed Alioski’s effort behind for a corner on 28 minutes, before Hernandez had a shot deflected behind.
The pressure finally paid off when Williams turned Jack Harrison’s cross into his own net on 33 minutes.
Dack fired wide two minutes later as Rovers looked for an immediate response while Alioski hit the bar with a curling effort as United continued to cause plenty of problems.
Alioski then saw an audacious overhead kick saved by Raya on 42 minutes.
But Rovers were level two minutes after the break when Mulgrew was fouled in the box by Ayling and he made no mistake as he fired low to the keeper’s left.
Hernandez was inches away from getting on the end of Alioski’s teasing cross on 50 minutes and Barry Douglas’ free-kick was headed to safety as Rovers started to get pushed back again.
Mateusz Klich guided an effort narrowly wide two minutes later, before Roofe just failed to get on the end of Hernandez’s cross.
Darragh Lenihan headed Richard Smallwood’s free-kick onto the roof of the net on 79 minutes for Rovers but Mulgrew curled a free-kick home from 25 yards to seemingly give Rovers the win.
But Roofe levelled after Raya failed to hold on to Hernandez’s shot and wrapped up the most unlikely of wins three minutes later when he headed home to send the stadium wild.