The Gemara asks how Rebbe Meir could learn from Elisha Ben Avuyah, who went, what we would today, call "Off The Derech". The Gemara answers that R' Meir found a pomegranate תוכו אכל קליפתו זרק - He ate the inside [the fruit] and discarded the peel.
The question still remains - How can one learn from a kofer???
Answered Rav Yechiel Yaakov Weinberg z"l:
Elisha went off the derech when he saw a child performing the mitzva of kibbud av and shiluach ha-ken at the same time and died in the process. He asked - How can it be that the Torah promises long life for the performance of these mitzvos and someone dies while performing them?? This caused him to veer from the path.
His "kefirah" came from a place of deep seated emunah. The Torah HAS to be correct. When he saw something that didn't fit with his emunah he was shaken to the core of his soul. Had he not believed so much to start with - he would not have been so incredibly shaken up. The root of his kefirah was a profound emunah.
Rebbe Meir ate the inside of Elisha's views, the fruit, the emunah pshutah that everything the Torah says MUST BE TRUE and threw away Elisha's heretical conclusions.
When we meet someone [and that someone may be ourselves] who has doubts, we must look deeper at where the doubts are coming from. The world was created by a Higher Power. That is an axiomatic no-brainer. I am very sorry to break the news - but "nothing" doesn't create anything. Certainly not a world as complex as ours. NOBODY believes that a computer can program itself so HOW ON EARTH [excuse the pun] did the planet - an infinitely more complex creation than a mere laptop - create itself??? C'mon. And the vast Universe, the galaxies, the milky way?? All by itself?? From nothing??? Of COURSE there is a G-d.
Kefirah [sometimes] comes from a place of "How can this G-d allow so much evil?" This comes from Emunah. The task is to get to the depths of the Kefirah, reveal the Emunah, and to thus come out an even stronger, deeper believer. From the thesis [G-d created and runs the world], to the antithesis [all of the chaos we see] to the synthesis [accepting G-d's deeper, higher, hidden plans to ultimately reveal His love and glory].
When I started the post, I told myself "No Rav Kook in this one". But I can't resist. He explains that sometimes kefirah is emunah and at other times emunah is kefirah!! How so? Some people's emunah is based on their IMAGINATION of what spirituality is. This is kefirah because they are living in a contrived, imaginary world. Other people are kofrim on the surface, but the god they are denying is a false god and the torah in which they don't believe is not the real Torah. Through their kefirah, if they search deeply enough, they will [often] come to emunah.
יש כפירה שהיא כהודאה, והודאה שהיא ככפירה. כיצד? מודה אדם שהתורה היא מן השמים, אבל אותם השמים מצטיירים אצלו בצורות כל כך משונות, עד שלא נשאר בה מן האמונה האמיתית מאומה. וכפירה שהיא כהודאה כיצד: כופר אדם בתורה מן השמים, אבל כפירתו מיוסדת רק על אותה הקליטה שקלט מן הציור של צורת השמים אשר במוחות המלאים מחשבות הבל ותוהו, והוא אומר, התורה יש לה מקור יותר נעלה מזה, ומתחיל למצוא יסודה מגדולת רוח האדם, מעומק המוסר ורום החכמה שלו. אף על פי שעדיין לא הגיע בזה למרכז האמת, מכל מקום כפירה זו כהודאה היא חשובה, והיא הולכת ומתקרבת להודאת אמונת אומן. ודור תהפוכות כזה, הוא נדרש גם כן למעליותא. ותורה מן השמים משל הוא על כל כללי ופרטי האמונות, ביחש של מאמר המבטאי שלהן אל תמציתן הפנימי, שהוא העיקר המבוקש באמונה
Of course, people have many hidden [even to themselves] and subconscious reasons for believing and not believing, but that is beyond the scope of this post.