gamecache is what you need, there should be a method in GUI or jass to store unit or hero, use it in first mission, and save the gamecache to file like mycache.cc, then use gamecache load to load the unit or hero into a unit variable in 2nd mission.
hashtable wont work since it doesn't physically write anything to a file on harddisk, it gets lost when map ends, its life span is same as the map's.