Computer-controlled heroes who have fallen in battle cannot be purchased on the same day under any circumstances. On the following day, a computer-controlled hero can be purchased only if he is IDENTICAL to the starting hero. That is, he has not gained experience, HAS NOT LEARNED ANY SPELLS (in particular, he has not purchased a magic book for Barbarians or Knights), and has not visited buildings that affect primary or secondary skills.
And here, it should be added:
purchasing fallen/fled heroes of a computer opponent;