Morals are base on natural laws. Thou shall not steal the property of others. Thou shall not do to others what he would not want done to self. These are moral values deriving from common sense, which is why they're considered natural law, they do not need to be thought. Rule and state laws are base on our civic duties as citizens. Although there can be some similarities, they don't always follow the same logic. State law - NO Parking, Do Not Enter. State laws doesn't have to follow common sense, it's an order. Having good morals doesn't help us accept State laws, it forces us to question why the law is there the first place.
In your example the act of saving a man fail short because the man died which could become consequential although the intent behind the attempt is just. But had the man lived the action saving the man should have become justified and praised. Therefore, the unlawful act of the man leaving the post is balanced out with the action of the man saving a life, which doesn't make the action of the man leaving the post lawful but canceled out by his brave act.