If I am remembering correctly, you can upgrade directly from a 39 level to a 40 level in another path. I believe it costs extra experience.
My opinion is, since the main reason for needing this option is to let you tailor your forces to your own advancement and production plans rather than having to live with the scenario's pre-arranged ones, this should be easier to do especially in the first turn of 1939 scenario.
Make any unit that starts at a 1939 level able to switch advancements at no or at least very minimal cost. Since the combat parameters for all 1939 Advancements are the same regardless of path that implies they haven't yet specialized so this shouldn't affect any game parameters.
The only other case for switching occurs much later, usually 42 or 43, when the Axis is changing from offensive to defensive and the Allies are making the change to offensive. Unit's at this stage will usually be at levels 41 or higher so the switch should cost them quite a bit both in experience (new equipment to learn tactics for), production (have to rearm), and logistics (new supply needs).
Easiest way (without knowing the program coding involved) would be to just let them switch to one step lower with a small experience penalty as well. An example being, if the Russians want to change from a defensive configuration to an offensive in 1943 they could switch their 1943 Anti Tank infantry to 1942 Assault Infantry.
Another example for early switch is if the UK player decides he needs air units that can stop SeaLion worse than supporting his troops they could switch their 1939 Bombers from Close Support to Naval at no cost. Later, once the SeaLion threat is gone, they could switch their 41 or 42 Naval bombers back to 40/41 Close Support.