A senior official in the north-west city of Peshawar on Thursday ordered a retrial.
Afridi has spent more than two years in detention having been arrested soon after the 2 May, 2011, raid when US Navy Seals secretly flew into Pakistan and shot dead the al-Qaeda terrorist leader.
It emerged that Dr Afridi had led a team of health workers in the town of Abbottabad as part of a fruitless effort to obtain DNA from Bin Laden’s relatives, evidence that would have proved the US target’s identity.
His conviction – for being a member of a militant group – drove a further wedge between Pakistan and the US, where he was hailed a hero.
Samiullah Afridi, Dr Afridi’s lawyer, said he was delighted the conviction had been quashed. He said he was confident Dr Afridi would be found not guilty when retried.
“He has never been part of this militant group,” he said. “If he gave money to them, it was because he had been kidnapped and his family had to pay a ransom. He should never have been convicted.”
Dr Afridi led a small team of health workers as they went door-to-door giving hepatitis vaccinations to children around Bin Laden’s hideaway in the garrison town of Abbottabad during the weeks before the raid.
Details of his work have trickled out during the past two years.
He told his Pakistani interrogators that he was asked by his CIA handler “Peter”, via satellite phone, initially to cover two neighbourhoods, according to a retired Pakistan army officer who was given access to interview transcripts.
However, he was soon asked to focus his efforts on a single house and asked for a payment of $10,000 (£6,450).
In an interview with Fox News conducted by telephone from behind bars, Dr Afridi admitted he was stunned when he realised the house was Bin Laden’s. “I was aware that some terrorists were residing in that compound, but I didn’t know whom,” he said. “I was shocked. I didn’t believe I was associated in his killing.”
Although Pakistani officials said Dr Afridi would be tried on treason charges – for aiding a foreign power – he was eventually convicted of being a member of Lashkar-e-Islam, a hardline Islamist group active in the Khyber region where he had worked.
His conviction sparked a war of words between Pakistan and the US.
Hillary Clinton, the then US secretary of state, denounced Dr Afridi’s treatment as “unjust and unwarranted”, while furious senators withheld $33 million of aid in protest. America accused Islamabad of being more interested in protecting terrorists than hunting them down.
However, aid groups criticised the CIA for using a vaccination project as cover for spying. They said it would make them targets for militant groups – claims borne out by a string of Taleban attacks on polio vaccination teams.
Meanwhile, Dr Afridi has been held largely in solitary confinement in Peshawar’s overcrowded prison.
On Thursday, a statement issued by the office of the commissioner in the north-western city of Peshawar, said the appeal had been successful.