I haven't used this technique in a long time because it's prohibited in offline mode, and I can't be bothered with it in online mode. In WoG, it's very simple, and everyone knows how to do it. But in SoD, it's a bit more complicated. If I remember correctly, when heroes meet, and they only have units with a size of 1, you need to do something with the Split key. I think it has to be done in the original SoD, without HD, because it seems like they fixed it in HD. I don't remember exactly.
I think I figured it out. The hero who is leaving should have one stack, and the hero who is being replaced should have a unit with a size of 1. Select the unit with a size of 1 and "split" it into an empty slot of the second hero. In the window that opens, click on the number 1 and the arrow to the right, then close the window.
It works in the mod; they fixed that version there, which is the one that works in WoG.