Create a dummy unit which has the same model of the hero e.g if the hero is Paladin, then you create a dummy unit with model Paladin
Then, by triggers, you check when the hero dies, wait for him to play his death animation and then through the Unit - Create Corpse, you create a corpse of the dummy unit.