What you need to realize and feed to your brain is that no one has a perfect life. In one way or another we all have our fair share of good luck and bad luck. Accepting defeat as a part of life and taking disappointments lightly can help you remain the positive individual that you need to be. However, this certainly does not mean that you stop learning from your mistakes. You should not repeat anything that has hurt you once.
Most people isolate themselves from social contact when they are going through this phase. In fact, they should do the contrary. Surround yourself with people you love and who care about you. You will immediately start feeling good about yourself. These could be family, friends and colleagues. You can also share with people who you can trust upon and they will talk you out of the phase. Sharing takes off the heavy load from the chest.
Indulge in an activity that you enjoy like book reading, theater, backpacking so that your mind is pleasantly diverted and you get over that gloomy phase. Exercise, yoga, meditation and religious prayers are known to have a calming effect on the nerves and you will find yourself at peace after practicing them. You can also get involved in charity and welfare activities for the less privileged. Apart from contributing to the society in a selfless way, you will also get satisfaction from the fact that you enjoy so many privileges that most do not and yet they are thankful and smiling.
Set goals for yourself and work on them diligently. Every small milestone that you reach will bring you a sense of achievement and you will automatically feel better about yourself. Prove to yourself that you are able to achieve something that you are determined for.