When defender Bambo Diaby deflected an Ilias Chair effort past his own goalie in the 37th minute, the Owls fell behind.
Early in the second half, Will Vaulks of Sheffield Wednesday had a goal straight from a corner ruled out for a foul on goalkeeper Asmir Begovic.
However, with four minutes left, they leveled things up thanks to a well-executed goal by Bailey Cadamarteri from Djeidi Gassama’s ball past Begovic, and Musaba then grabbed the winner in stoppage time.
After winning three of their previous four games, their opponents’ advantage was reduced to four points, although both teams were still in the relegation zone.
Due to their late comeback, Danny Rohl’s club has now won three of their last five home league games, ending QPR’s four-game winning streak.