yes, блин is a pancake but in russian it also sounds almost like блядь which means a very bad word. And thus блин is used as much more acceptable form of блядь and can be inserted anywhere in the sentence. It will help you show your emotion - surprise, bad mood and lot's of others. It can be translated only if you understand what the quthor is talking about and read from the context about his mood.
But do not use блин often - it's informal and may be used when you are with among good friends otherwise it would mean that your manners are bad and you have bad education degree