A former British army officer facing two years in an Afghan jail has had his bribery conviction overturned.