The capital club, who had been beaten 3-0 by Serie A leaders Juve earlier this month, dictated play for much of a scrappy encounter and were rewarded with a victory that keeps alive their hopes of avenging a defeat to Lazio in last year's final.
It was former Arsenal forward Gervinho who emerged as the hero as he struck 11 minutes from time with a superb backheel volley to condemn Juve to a first domestic loss since a 4-2 defeat to Fiorentina on October 20.
In grabbing the winner, Gervinho set up a potential rematch for Roma with Lazio, who travel to Napoli next Wednesday.
Roma were fortunate not to be reduced to 10 men after 14 minutes when the referee elected only to caution last defender Mehdi Benatia for a foul on Sebastian Giovinco.
The hosts enjoyed the better of the first half without creating any real goalscoring opportunities, veteran playmaker Francesco Totti going closest just after the half-hour mark as he sent a left-footed volley wide.
Juve looked to have taken the lead a minute into the second half as Federico Peluso headed in at the far post, only for the linesman to rule that the ball had crossed the byline and gone out of play in the build-up.
Alessandro Florenzi then went close with a header for Rudi Garcia's men, before the 75th-minute introduction of midfielder Miralem Pjanic proved decisive.
Bosnia-Herzegovina international Pjanic needed just four minutes to make an impact, the former Lyon man surging into the penalty area before laying the ball off for Kevin Strootman, whose near-post cross was turned home in stunning fashion by Gervinho.
Juve failed to mount any sort of revival and, although Pjanic wasted a chance to add a second in injury time, Roma held on to progress and spark raucous scenes at the Stadio Olimpico.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.