***DISCLAIMER***The following is far from an exhaustive answer to the question. It is simply an answer nonetheless.
Recently, someone asked me where sinful thoughts originate for believers. What follows is the question followed by my response to it.
For believers, where do sinful thoughts come from? I see in Scripture that evil thoughts come from the heart. But as believers, our hearts are new. We are new in the Spirit, but now we struggle with the flesh. As a result, are these evil thoughts now coming from my flesh?
You have asked some very good questions.
Sinful thoughts certainly do not come from God. After all, God’s thoughts and ways are certainly not like ours (Isaiah 55:8). Instead, sinful thoughts come from the heart of man (Matthew 15:15-20; Mark 7:14-23). Even though believers are given a new heart when being born-again, they are still admonished to both guard the heart and take every thought captive to Christ’s obedience (Proverbs 4:23; 2 Corinthians 10:1-6). After all, it is out of the overflow of the heart that the mouth speaks (Matthew 12:34; Mark 7:21-23). While the born-again believer has a new heart, he/she still struggles with the flesh. The apostle Paul details this struggle in Romans 7:14-8:17 (NASB):
14 For we know that the Law is spiritual, but I am of flesh, sold into bondage to sin. 15 For what I am doing, I do not understand; for I am not practicing what I would like to do, but I am doing the very thing I hate. 16 But if I do the very thing I do not want to do, I agree with the Law, confessing that the Law is good. 17 So now, no longer am I the one doing it, but sin which dwells in me. 18 For I know that nothing good dwells in me, that is, in my flesh; for the willing is present in me, but the doing of the good is not. 19 For the good that I want, I do not do, but I practice the very evil that I do not want. 20 But if I am doing the very thing I do not want, I am no longer the one doing it, but sin which dwells in me.
21 I find then the principle that evil is present in me, the one who wants to do good. 22 For I joyfully concur with the law of God in the inner man, 23 but I see a different law in the members of my body, waging war against the law of my mind and making me a prisoner of the law of sin which is in my members. 24 Wretched man that I am! Who will set me free from the body of this death? 25 Thanks be to God through Jesus Christ our Lord! So then, on the one hand I myself with my mind am serving the law of God, but on the other, with my flesh the law of sin.
Deliverance from Bondage
8 Therefore there is now no condemnation for those who are in Christ Jesus. 2 For the law of the Spirit of life in Christ Jesus has set you free from the law of sin and of death. 3 For what the Law could not do, weak as it was through the flesh, God did: sending His own Son in the likeness of sinful flesh and as an offering for sin, He condemned sin in the flesh, 4 so that the requirement of the Law might be fulfilled in us, who do not walk according to the flesh but according to the Spirit.5 For those who are according to the flesh set their minds on the things of the flesh, but those who are according to the Spirit, the things of the Spirit. 6 For the mind set on the flesh is death, but the mind set on the Spirit is life and peace,7 because the mind set on the flesh is hostile toward God; for it does not subject itself to the law of God, for it is not even able to do so, 8 and those who are in the flesh cannot please God.
9 However, you are not in the flesh but in the Spirit, if indeed the Spirit of God dwells in you. But if anyone does not have the Spirit of Christ, he does not belong to Him. 10 If Christ is in you, though the body is dead because of sin, yet the spirit is alive because of righteousness. 11 But if the Spirit of Him who raised Jesus from the dead dwells in you, He who raised Christ Jesus from the dead will also give life to your mortal bodies through His Spirit who dwells in you.
12 So then, brethren, we are under obligation, not to the flesh, to live according to the flesh— 13 for if you are living according to the flesh, you must die; but if by the Spirit you are putting to death the deeds of the body, you will live. 14 For all who are being led by the Spirit of God, these are sons of God. 15 For you have not received a spirit of slavery leading to fear again, but you have received a spirit of adoption as sons by which we cry out, “Abba! Father!” 16 The Spirit Himself testifies with our spirit that we are children of God, 17 and if children, heirs also, heirs of God and fellow heirs with Christ, if indeed we suffer with Him so that we may also be glorified with Him.
After detailing the struggle Paul goes through daily with his flesh (7:14-25), he discusses how there is no condemnation for those in Christ Jesus (8:1). Paul then differentiates between the law of the Spirit of life and the law of sin and death (verse 2). He then differentiates between the flesh and the Spirit (verses 3-13). While this passage does not deal with thoughts verbatim, it does address the fact believers must put to death the deeds of the flesh. In doing so, one can very well demolish those thoughts that could lead to sin.
I hope this helps.