Brian Kelly, a former traffic policeman, served four years in jail for the 1987 rape of a woman in her Largs, Ayrshire, home after a jury heard what was thought to be cast-iron scientific evidence of his guilt.
A DNA sample that Kelly gave to police to eliminate himself as a suspect from their inquiries was found by scientists to match a stain found on the woman's dressing gown.
During his 1989 trial, scientists said the chance of the match being incorrect was 100,000 to one.
On Friday, an appeals court ruled the evidence had been mishandled and his conviction was being quashed.
"It's an indication of the dangers of putting science and scientists into special and privileged positions in court," said lawyer John Scott of the Scottish Human Rights Center.