The extent to which evolution is reversible has long fascinated biologists. Most previous work on the reversibility of morphological and life-history evolution has been indecisive, because of uncertainty and bias in the methods used to infer ancestral states for such characters. Further, despite theoretical work on the factors that could contribute to irreversibility, there is little empirical evidence on its causes, because sufficient understanding of the mechanistic basis for the evolution of new or ancestral phenotypes is seldom available. By studying the reversibility of evolutionary changes in protein structure and function, these limitations can be overcome. Here we show, using the evolution of hormone specificity in the vertebrate glucocorticoid receptor as a case-study, that the evolutionary path by which this protein acquired its new function soon became inaccessible to reverse exploration. Using ancestral gene reconstruction, protein engineering and X-ray crystallography, we demonstrate that five subsequent 'restrictive' mutations, which optimized the new specificity of the glucocorticoid receptor, also destabilized elements of the protein structure that were required to support the ancestral conformation. Unless these ratchet-like epistatic substitutions are restored to their ancestral states, reversing the key function-switching mutations yields a non-functional protein. Reversing the restrictive substitutions first, however, does nothing to enhance the ancestral function. Our findings indicate that even if selection for the ancestral function were imposed, direct reversal would be extremely unlikely, suggesting an important role for historical contingency in protein evolution.