It doesn't really mean 'cheer up'. 'Pull it together' or 'Pull yourself together' has a much broader meaning. Basically, it means that you want the other person to regain control of their emotions. This can be in any situation. For example, if someone is panicking, crying, screaming or laughing uncontrollably, you'd say this if you wanted them to calm down and act in a more controlled and reasonable manner.