A definition I heard and considered useful included a few required elements. A hero:
- Acts voluntarily and altruistically
This excludes most military and first responders, such as the prison laborers in your hypothetical. Hero is not a profession. Heroes also can't have any moral or legal duty to the rescued, such as pulling victims out of the fire you started yourself.
- Leaves a place of safety
You can't be a hero by saving others incidental to saving yourself. A hero must have had the safe option to merely be a bystander to the emergency.
- Subjects oneself to risk of death of serious injury
Heroes don't have to die in the act of heroism, but they must have been cognizant of that possibility and chosen to act in spite of the risk.
- To aid an stranger
You can't be a hero by saving your children, or anyone you have a duty to protect, or anyone you expect to be able to reward you in the future.
That Pete Seeger song (which isn't really his, but that's the version I heard) has Cuban Spanish lyrics and isn't at all about a One Ton Tomato.