Many years ago a young man who came from a more modern home decided to become more observant. His father had been from a family of Gerrer chasidim before the war and he wanted to return closer to his roots. He ended up in Lakewood yeshiva [not so chasidish but still a great place to learn....]. The Heilige Beis Yisrael ztz"l the Gerrer Rebbe wanted to guide this young man from a distance so he had his trusted chossid and confidante, Mori Vi'rabbi the Tolna Rebbe [then a young man], keep up a correspondence with him.
One day the [Tolna] Rebbe Shlita received a letter the young man had written him. He related that there was another student in the yeshiva who was going through a terrible crisis. This boy was one of the top learners in the whole yeshiva, a real super-lamdan. But he was obsessed with thoughts that he must become a ... Christian. ממש thoughts of avoda zara. This made it EXTREMELY difficult for him to daven and learn. His friend wrote the Tolna Rebbe asking him if he has any advice.
The Rebbe Shlita showed the letter to the the Beis Yisrael. The Beis Yisrael instructed the Rebbe shlita to take a gemara shabbos of the shelf and told him to turn to daf קיט where is says כל העונה אמן יהא שמיה רבא בכל כחו אפילו יש בו שמץ עבודה זרה מוחלין לו - "Anybody who answers amen yehei shmei raba, [may Hashem's name be great forever and ever], with all of his strength and kavana, even if he has dabbled in avoda zara, he will be forgiven."
The Gerrer Rebbe asked the Rebbe shlita what he learns from this gemara. The Rebbe replied that he learns the power of answering amein yehei shmei raba properly. It can atone even for avoda zara.
The Gerrer Rebbe replied that he learns something else from this gemara: That a person can dabble in avoda zara and still answer amen yehei shmei raba properly. So tell the boy to tell his friend to continue davening and learning and it will be OK.
And so it was. Eventually the thoughts disappeared and he became a maggid shiur and many students thirsted in his Torah.
[Heard from the Rebbe Shlita during the course of his shiur between Kabbolas Shabbos and Maariv]
זכות הצדיקים יעזור ויגן ויושיע!
So sweet friends - if you have disturbing thoughts related to avoda zara, heresy, the opposite gender or anything else - don't let it affect your avodas Hashem. Ignore them and they usually go away.
Love and blessings:-)