Pjanic embarrassed substitute goalkeeper Ben Amos with a looping shot from inside his own half, but the Italians were beaten 3-2 in Denver.
After a drab opening half hour, Wayne Rooney put United ahead with a fine curling shot at the Sports Authority Field.
Rooney then set up Juan Mata with a fine pass, before he slotted home a penalty after Danny Welbeck was brought down in the box.
A much-changed United team were not quite as deadly after the break, and they conceded the first goal of their pre-season tour when Pjanic spotted Amos off his line and lobbed him from inside his own half.
Francesco Totti added a second in the final minute from the penalty spot.
Although it was not as convincing as Wednesday night's thrashing of the Los Angeles Galaxy, Van Gaal will still be pleased to rack up another win on tour.
Again, the 3-5-2 system proved effective and his team showed energy even though they were playing in 30 degree heat, 5280 feet above sea level.
Welbeck, Rooney and Mata combined well up front while there were impressive performances from youngsters Tyler Blackett, Reece James and Will Keane.
United now head to Washington DC for the second game in the International Champions Cup against Inter Milan.
United came flying out of the blocks against the Galaxy, but Roma did not allow them to settle in Denver.
In fact, the Italian giants would have been ahead in the second minute had it not been for the sun-baked pitch.
Mattia Destro beat the offside trap and plucked a long ball from Arturo Calabresi from the sky, but his lob over Sam Johnstone landed two yards in front of goal and bounced over.
A dull half-hour period ensued. Roma were wasteful on the attack and United's passing was well below the standard they showed in Los Angeles.
Van Gaal made his feelings clear to the team during a two-minute water break, but United still struggled to keep hold of the ball.
Destro again pierced the United back line and squared to Alessandro Florenzi, but he shot straight at Johnstone.
Then United took hold of the match with two superb goals in three minutes.
First, Rooney collected the ball from Mata and curled a stunning shot over Lukasz Skorupski from 25 yards.
And the England striker then returned the favour, firing a 45-yard ball over the Roma defence to Mata, who killed the ball with his first touch before superbly lifting it over Skorupski.
United were now in top gear. In first-half injury time a lovely passing move ended with Welbeck being brought down by Mehdi Benatia in the box following a pass by Ander Herrera.
Rooney stepped up and dispatched the ball past Skorupski to make it 3-0.
Van Gaal made nine changes at the break. Ben Amos, Michael Keane, Chris Smalling, Ashley Young, Shinji Kagawa, Luke Shaw, Nani, Jesse Lingard and Will Keane came on.
But there was no introduction for Wilfried Zaha, who is the only United squad member not to be used by Van Gaal on this tour.
Will Keane made an immediate impression, breaking through the Roma defence, but he was hauled down clumsily by Benatia. Incredibly, referee Allen Chapman awarded a free-kick to Roma.
Javier Hernandez came on to a good reception from the United fans inside the stadium.
The whole crowd were brought to their feet with 15 minutes to go when Pjanic scored.
The Bosnian, a full 10 yards inside his own half, spotted Amos off his line and fired a long looping shot over the red-faced United goalkeeper.
Amos then went some way to redeeming himself by tipping Leandro Castan's acrobatic effort on to the woodwork.
The United stopper was beaten from the spot by Totti after the referee awarded a questionable penalty against Michael Keane.