And that's the sign of a good character. Sure you have to have a good idea on who they are, so you can be consistent throughout the story, but you also have to learn when it's a good time for them to step out of character, and do something purely based on emotion rather than personality. It's hard, but they managed to pull it off right.
Plus Sam was the big hero in the end.