The Manchester City forward opened the scoring in the 29th minute, nodding in a free-kick from Zvjezdan Misimovic to send the 12,000 crowd wild with delight at the Bilino Polje stadium.
Seven minutes later Misimovic had a penalty saved by Orestis Karnezis but Vedad Ibisevic pounced on the rebound to put Bosnia 2-0 up.
Dzeko, who celebrated his 27th birthday on Sunday, scored with another header in the 54th minute to make the game safe.
Theofanis Gekas pulled one back for the Greeks in stoppage time when he converted a pass from Giorgos Samaras.
"I'm now gripped by a kind of fear," said Bosnia coach Safet Susic. "After this terrific result... nobody would forgive us if we fail to reach the finals in Brazil.
"We have to seal it with victory in Latvia," he added, referring to their next qualifier on June 7.
Bosnia now have 13 points from five matches, three ahead of Greece and five in front of Slovakia.
The Bosnians have never qualified for a major tournament as an independent nation.
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.