This is something that many of us have struggled with, and in some cases continue to deal with. The good news is that it can be overcome, or at the very least controlled enough that it no longer inhibits what you are now trying to accomplish.
First suggestion, and it's a biggy don't get angry with yourself. This can be a very hard and difficult thing to master, but in the end it will help you immensely. It has been my experience, and belief, that when we get angry it puts our mind and spirit in a negative space. This can do just as much damage, if not more, than the problem at hand. This is also something I still struggle with, so be patient with yourself. ;)
Now, as to breaking the mental habits, I do have a few exercises that may help you, but again patience and consistency will work greatly to your advantage. But they can make it easier in the end.
First-A, create a mental "delete" button. When a thought, or feeling, comes to you that you don't wish to have, take a deep breath, close your eyes and visualize a delete button from a keyboard in your mind and mentally hit the "delete" button. This could also be applied to other images, such as seeing the thought written on a piece of paper, then taking that paper, crushing into a ball, and tossing it into a waste bin. You get the idea.
First-B, the "delete" button can also be taken into the real world. Many find it helpful to write down those negative or inhibiting thoughts and feelings. Some choose to write them on small bits of paper and burn them, or write down the thought, cross it out, and underneath it write what you would like to think instead. Others simply keep a "journal" of sorts. There are many beliefs that writing things down is a way of removing those thoughts from the mind.
Second, is replacement. In this case, I found this to be the easiest method for me in the beginning. Simply put, when a thought creeps in, stop it (even in mid-sentence, so to speak) and replace it with another, more positive thought. I used the "Winnie the Pooh" theme song, lol. Yes, you read right. :D It worked though. So your replacing thought can be anything from an affirmation, like, "That is no longer who I am. I am expanding my spirit for the better., or a song. It's what will work best for you.
Third, debate with yourself. Yes I am asking you to talk to yourself. It's not as crazy as some may believe. ;) In other words, when a thought comes up, talk to it as if it was another person who as condemned your new found path. But just like you should with a real person, be respectful. This is, after all, you that you're talking to. Try to convince this "other voice/person" why you have chosen to take this road instead of the one you were on. If in the end, the debate meets a stalemate, try not to get angry or frustrated, simply agree to disagree for the moment and move on.
Fourth, meditation. It is a practice that holds true for most, whether they are new or a master. It can be a great help with things like this. Again do what feels best for you. If you like darkness and quite to meditate, then do that. Others enjoy music and burning incense. It should be a relaxing and comfortable experience.
Don't be surprised that even after you get your thoughts/feelings under control that they don't completely go away. I was raised in a very strict United Pentecostal Christian church. Many of their teaching were very difficult to overcome. In fact, though I have not considered myself religious in about 15 years, there is the odd occasion when an old belief will still rear its head. This has diminished significantly over the years, and I get that "old feeling" at most maybe once a year, but now I can look at it clearly, as simply an after effect of a past teaching and not what rules me now.
I hope this helps, and I wish you all the luck in your new found journey.
Peace Be Yours,