I'm not sure about the mechanism behind vitamin C synthesis, but sometimes a novel gene can be transferred from one population to another by way of a virus. Interesting to think that such a gene could be lost for 1000 years, only to be reintroduced into a totally different population by way of a virus and some transposons.
The Genetics of Vitamin C Loss in Vertebrates
Vitamin C (ascorbic acid) plays important roles as an anti-oxidant and in collagen synthesis. These important roles, and the relatively large amounts of vitamin C required daily, likely explain why most vertebrate species are able to synthesize this compound. ...
www.ncbi.nlm.nih.gov