Dude, all I can say is find something that lifts you out of it. A good freind who is reliable, or confide in your wife. These thoughts cannot consume you and if you let them, then youve lost. RIght now I am going thru some bad times since my twin brother, mymother, and a an acquaintance at the bar I go to have been extremely rude and disrespectful to me over the past year. Picking on me, shouting at me so easily and carelessly. It is affecting my self esteem and im trying to stay happy. It has affected me at work and Ive messed up reports with these haunting thoughts. I have a few good freinds and I exercise, and I like my job, but the bad parts have really done a nummber on me. Do what you can to stay hapy. Good luck.
All of the above are great suggestions but sometimes we need others to listen and teach us ways to improve our lives and so if you are fed up then please see a psychologist. It can really turn your mind and your life around. I'm sure you have OCD issues that need to be dealt with and with that the other stuff will fall into place. We are all unique and we all have something to contribute and that includes you. Take care and be the best person you can be :)
Try to see the positive side, if you change your behavior, it will change your personality
Are there any areas in your life or any skills that you have that make you feel confident? For example, could you set a small exercise goal or learn something new? Sometimes setting and meeting an attainable goal is a way to get back some confidence. Also, is there a time when you solved a problem at work or received an honor? If so, spend some time reminding yourself of your accompllishments (which can be anything including being married) and you can also start a gratitiude list. This always helps me, overall I have a lot to be thankful for...I wish you luck.