It means the champions have recorded only one win in seven games across all competitions for the first time since 2010.
Claudio Ranieri's men looked to be heading for a disappointing draw that could have contributed to them potentially ending this round of fixtures five points adrift of the Champions League spots, but Florenzi and then Dzeko found the net in the final 11 minutes to keep them right in the race.
A thrilling first half brought a host of chances, with Antonio Mirante in the Roma goal impressing, while the woodwork denied both Lorenzo Pellegrini and Paulo Dybala at either end.
Despite Roma's greater need for a result, Juve continued to look the more threatening in the second half, but Florenzi made the most of his solitary opportunity and Dzeko wrapped victory up on the break, moving the hosts to within a point of fourth-placed Inter ahead of their game against Chievo on Monday.
Juve made a lightning start and went close three times in the first 16 minutes, with Cristiano Ronaldo shooting just wide before Mirante produced remarkable saves from Juan Cuadrado and Dybala.
Moments later Juve were worried at the other end – Pellegrini striking the crossbar from inside the box after a rapid counter.
Roma remained reliant on Mirante, however, as he blocked Dybala's effort in the 28th minute and the ball subsequently came back off the post.
Ronaldo thought he had opened the scoring just past the hour when slotting past Mirante, but a VAR review showed he had strayed offside.
Roma capitalised in the 79th minute, as Florenzi raced onto Dzeko's pass and clipped a lovely finish over the approaching Wojciech Szczesny.
And Dzeko sealed the important victory on the break in stoppage-time, sweeping home from Cengiz Under's precise pass.
What does it mean? Roma right in the hunt
The race for Champions League qualification in Serie A is going to make for intriguing viewing over the next couple of weeks. Just three points separate third from sixth, and Roma have a fairly kind finish to the campaign, as they face Sassuolo and Parma.
AC Milan will also fancy their chances of ending the season with victories against Frosinone and SPAL. Inter and Atalanta – fourth and third respectively – both have to play against one of the top two. It is all to play for.
Roma's goalkeeper was the best player on the pitch by some distance. He made several particularly fine saves in the first half and also proved dependable after the break.
Ronaldo fails to shine
Granted, Juve had little to play for, so perhaps Ronaldo felt obliged to take it easy, but he was frustrating in Rome, having little impact in the final third. He was made to look particularly daft in the second half when, shortly after mocking Florenzi's height in a spat, the Roma man opened the scoring.
Juventus return home next Sunday for their penultimate Serie A game of the season against in-form Atalanta, who are firmly in the hunt for a Champions League place. Roma's own top-four chase resumes away to Sassuolo a day earlier.