Serie A: Roma 4 Inter 2
Having seen Juventus snatch a late 2-1 victory over Torino earlier in the day, the pressure was on Roma to produce a win at Stadio Olimpico.
Gervinho's 21st-minute opener was well-deserved after a bright start, but Andrea Ranocchia headed level 15 minutes later against the run of play.
The hosts' lead was re-established when Jose Holebas smashed home two minutes after the interval.
Inter refused to go down without a fight, though, and equalised again courtesy of a deflected Pablo Daniel Osvaldo strike 10 minutes later, but Pjanic proved to be the difference between the sides - netting twice before time was up to keep Roma within three points of league leaders Juve.
Inter, meanwhile, suffered their first defeat since Roberto Mancini - who was sent off after Roma's third goal - returned to the club, and have now slipped to 11th in the Italian top flight.
Rudi Garcia made two changes to the Roma side that played in the disappointing 1-1 UEFA Champions League draw against CSKA Moscow on Tuesday, bringing Pjanic and former Inter man Maicon in for Daniele De Rossi and Alessandro Florenzi, while Yann M'Vila, Rodrigo Palacio and Hugo Campagnaro came into the Inter side after their 2-1 win over Dnipro in the Europa League on Thursday.
Inter appeared content to sit back and make life as difficult as possible for Roma's attackers in the early stages, but Gervinho threatened to unlock their determined defence with a darting run down the right in the 19th minute.
That move eventually came to nothing, but the Ivorian made no mistake when he was served the ball on a plate by Adem Ljajic two minutes later - tapping home his second league goal of the season to break the deadlock.
Zdravko Kuzmanovic squandered an opportunity to hit Inter with an almost-instant reply when Morgan De Sanctis got down brilliantly to his left to tip the Serbia international's shot around the post, before Gervinho had the ball in the back of the net again, only to see the goal ruled out for offside.
Having dealt with Inter's first shot on target superbly, De Sanctis was helpless as Ranocchia rose highest at a 36th-minute corner to head in the first goal Roma have conceded at home in Serie A this season.
Roma emerged for the second half determined to re-claim the advantage and had to wait just two minutes to do exactly that - Holebas beating two defenders as he burst his into the box to blast an effort into the top right corner.
Osvaldo's overhead kick at the other end was an optimistic, and ultimately unsuccessful, bid to restore parity, but fortune favoured the brave and the Argentina-born striker's next shot at goal deflected beyond De Sanctis off Davide Astori.
Radja Nainggolan saw a low drive well saved soon after, and Roma went in front for a third time when the ball fell kindly for Pjanic in the centre of the penalty area, with the Bosnian stroking home with ease, although Inter felt they should have been awarded a free-kick in the build-up.
Inter pressed for yet another leveller after boss Mancini had been banished from the bench for his earlier protestations, but a 25-yard curling free-kick from Pjanic in stoppage time ended any lingering hopes of forcing a result.