Osvaldo deftly headed home from a corner in the dying seconds to give Roma a barely deserved victory and move them up to fifth on 58 points, four ahead of Udinese who host struggling Sampdoria on Sunday (1300 GMT) and only three behind fourth-placed Fiorentina.
Vincenzo Montella's Fiorentina side created the best chances, twice hitting the post, but will be four points away from the third Champions League place should AC Milan beat Torino (1300 GMT) on Sunday.
Chievo Verona edged closer towards Serie A survival with an uninspiring goalless draw with Cagliari that left them in 13th place on 40 points, eight points clear of third-bottom Genoa. Genoa host bottom club Pescara on Sunday (1300).
Fiorentina could have had a penalty with 15 minutes left, when Italy midfielder Daniele De Rossi appeared to handle an Adam Ljajic cross in his own area, and Montella looked crestfallen afterwards.
"I'm really upset for the lads because they put in a superb performance, but I don't think we should focus on one incident," he said.
"Certain decisions I didn't understand, but I'll talk about that with the referee. It (Champions League qualification) still depends on Milan, but if they draw there is still only a small gap."
Despite the match being a meeting of two of Italy's best attacks, and Roma having the second worst defence in the league, the first half was a tight affair with few chances.
Stefan Jovetic came closest to opening the scoring eight minutes before the break, latching onto an Alberto Aquilani shot and forcing a superb save from Roma keeper Bogdan Lobont, who tipped the close range effort onto his near post.
Fiorentina came close three times in two minutes just before the hour mark, with Llajic's low drive drawing a superb save from substitute keeper Mauro Goicoechea, who replaced Lobont at half time after the Romanian fractured his nose in a challenge for the ball.
David Pizzaro then went close with a drilled long-range shot, before Aquilani was denied only by last ditch Roma defending when he looked certain to score against his former club.
Roma brought themselves back into the game but in the last minute of normal time Fiorentina almost scored when Pizzaro thumped a shot past Goicoechea that crashed back off the bar.
A draw that was of little use to either side looked inevitable until Osvaldo popped up on the edge of the six yard box up and headed home the winner that could yet see him back in Europe next season. — Reuters