Zimbabwe qualified for the second round 3-2 on aggregate thanks to a stoppage-time goal from star forward Khama Billiat, who plays for South African club Kaizer Chiefs.
Somalia, who have to play home matches in fellow east African country Djibouti because of an unstable security situation in Mogadishu, took a 1-0 lead into the first round second leg.
The victorious first leg team included Mohamud Ali, who combines playing sixth-tier football in England with working as a driving instructor in Manchester.
Somalia, the equal lowest ranked national team in Africa with Eritrea, had looked set to win a World Cup tie for the first time when they equalised in Harare with seven minutes remaining.
The goal from Omar Abdullah Mohamed gave the Somalis a 2-1 aggregate advantage and left Zimbabwe needing at least two goals to avoid a shock elimination.
Knox Mutizwa got the first of the two direct from a free-kick with four minutes left and Billiat rifled a shot over the goalkeeper two minutes into stoppage time.
Marshall Munetsi had set up the dramatic finish by putting Zimbabwe ahead on 77 minutes with a spectacular overhead kick when the Somalis failed to clear a corner.
Overall success was a massive relief for new Zimbabwe coach Joey Antipas, who last month inherited a team that fared poorly at the recent Africa Cup of Nations in Egypt.
After losing narrowly to the host nation, Zimbabwe drew with Uganda and were hammered by the Democratic Republic of Congo to make a first round exit.