A highly diastereoselective synthesis of (R,S) or (S,S) 2,6-disubstituted dehydropiperidines and 2,7-disubstituted dehydroazepanes has been developed. The stereochemical preference for the (R,S) or the (S,S) isomer is governed by a tin-lithium exchange/electrophilic trapping sequence combined with a ring-closing metathesis. Their relative order was found to have a dramatic influence on the interaction controlling the epimerization at the anionic center. In each case, the complete stereodivergence of the reactions sequence is explained by considering the stabilization brought by the lithium-carbonyl coordination and rationalized by DFT calculations.