The European side headed into the encounter at the Arena Fonte Nova in Salvador having already been knocked out of the tournament, while their opponents still had a chance of progressing to the round of 16.
However, it was Bosnia who seized the initiative and surged ahead in the 23rd minute, when Manchester City striker Dzeko latched onto a pass from Pjanic and fired home from outside the box.
A minute later Iran could have equalised had Masoud Shojaei not been denied by the crossbar with a powerful shot from inside the Bosnian penalty area.
The Iranians failed to stage a comeback, though, as Safet Susic’s side doubled their advantage just before the hour mark.
Dzeko played the ball to Tino-Sven Susic, who then teed up Pjanic to guide it past goalkeeper Alireza Haghighi with his right foot from inside the box.
Although Iran halved the deficit through Reza Ghoochannejhad in the 82nd minute, Vrsajevic restored Bosnia’s two-goal advantage with a good finish just a minute later, as the Asian team went out of the tournament with just a point in their account.
Dzeko looked lively early on so it was no surprise when he opened the scoring after 23 minutes.
Iran's solid defence against Argentina had won plaudits even in defeat to a late Lionel Messi goal, but with victory imperative in Salvador, they left themselves a lot more open and Bosnia had no trouble exposing them.
Pjanic was given plenty of time to pick out Dzeko, himself afforded too much space, and the City striker set off on a diagonal run from right to left before shooting past Haghighi from 25 yards.
Iran almost produced the perfect immediate response with Shojaei's shot cannoning back off the crossbar with Stoke City goalkeeper Asmir Begovic beaten, but Ghoochannejhad was thankful that an offside flag meant his botched attempt to convert the rebound was irrelevant.
Bosnia retained a degree of control and late in the half right-back Vrsajevic scuffed a shot wide of the far post with Vedad Ibisevic visibly annoyed he did not cross to him just outside the six-yard box.
Their second - which finally eradicated Iran's chances - just short of the hour was self-inflicted. Jalal Hosseini gave away possession in his own half and was severely punished as Susic provided the pass for Pjanic, who was borderline offside, to slide home.
Ghoochannejhad struck with eight minutes to go, but there was not even time for Iran to consider an unlikely comeback before Vrsajevic drilled home Bosnia's third from a narrow angle.