I Peter 5 ... Be sober, be vigilant; because your adversary the devil, as a roaring lion, walketh about, seeking whom he may devour: 9Whom resist stedfast in the faith, knowing that the same afflictions are accomplished in your brethren that are in the world.
The devil will destroy anyone who will allow himself to be destroyed.
So we are told to "resist" ... stedfast in the faith ...
We have to talk ourselves through the faith when the devil attacks, remembering the works of God in the Bible and then remembering how God has worked in our lives ... building faith in God in the midst of the attack ...
And we should not be surprised when we have disturbing thoughts about an issue which was previously disturbing that we thought we had settled before with prayer .... I find I am often disturbed this way, by something that I thought I had settled. When that happens I usually just call on God for help. It is sort of like the times I've had a tooth problem and accidentally hit that tooth with water and sharp pain comes and I "freeze" and cry out, "God help me!" The pain subsides.
That is the way I often deal with memories of bad things I did in past. I just stay very still and cry out, "God help me." and I don't move until the memory drifts away. Often that memory is like a puff of smoke. Appearing then vanishing (for a season, only to return again)
The main thing I do is cry out to God for help. And stay still until it vanishes.