Your cry for cleansing has been heard, and it is a good and needful prayer to ask the Lord to purge the mind of that which defiles it.
The heart is a den of evil, and from it flow evil thoughts, and the Lord judges not only the outward act but the inward motion of the soul by which it is instigated. Do not make light of evil thoughts, for they are not a trifle in His sight. They are the very nest in which the principle and soul of sin is found, the dark woods that harbor all sorts of evil and the fever lairs where sin fattens and grows. An evil image lodged in the memory, a title or tune that returns unbidden, these are signs of what is within and they would not so trouble you if you did not know them to be contrary to the holy mind of God. Yet there is remedy.
The blood of Jesus Christ His Son cleanses us from all sin. Though your thoughts if they could be recorded would make you startle, that precious blood is able to save unto the uttermost them that come unto it. However high you have sought to ascend, still you need that cleansing, and it is freely given to those who confess and look to Christ alone for salvation. There is no other way of peace, for He was God when as yet sun and moon slept in His thoughts like unborn forests in an acorn, and He alone can wash the conscience and make the memory clean.
You ask that God would remove what now torments you. Hear then what He commands you to do. Cast your burden upon the Lord. You have a burden upon your back and upon your mind, and He bids you cast it upon Him. His thoughts are not your thoughts, neither are His ways your ways, for as the heavens are higher than the earth so are His thoughts higher than yours. Your thoughts run toward that evil image and that haunting song, but His thoughts toward you are constant, kind, wise, tender and gracious, even thoughts of love from everlasting. How precious also are His thoughts unto us, and how great is the sum of them. When you awake, you may be still with Him.
In renewing your strength, ask the Lord that your mind may be filled with a nobler tune. They that wait upon the Lord shall renew their strength, and this renewal comes not by your own power, for whatever strength is your own will one day fail you. It comes by waiting, by prayer, by filling the mind with what is revealed by God. Preach to your own soul not your own notions but what is revealed, for that shall be the power of God unto salvation. Overcome evil with good, for nobody ever overcame evil by confronting it with evil. Evil for evil is a sharp edged tool which cuts the man who uses it and hurts the mind permanently. But the mind of Christ turns from the evil and gives itself to the good, and so the evil is overcome.
Therefore, when the image or the title intrudes, do not parley with it or roll it under the tongue as a sweet morsel. Turn at once to the Lord in prayer, repeat some precious promise or psalm, set your thoughts upon His Word, and ask for the help of the Holy Spirit to think upon whatsoever is pure and holy. Cease from even thinking about the matter in your own strength and refer it to the Great Thinker who can bring good out of evil and light out of darkness.
Let us pray for you. Heavenly Father, look upon this burdened one who desires a clean mind and a pure heart. Forgive all sin through the blood of Jesus Christ, and cleanse the conscience from dead works. Remove, as it pleases Thee, the evil image and the remembrance of that song which now vexes the soul, and where Thou seest fit to leave the memory of it, give grace to overcome it with good and to set the thoughts upon Thyself. Renew strength in waiting upon Thee, let Thy precious thoughts be the daily bread of this soul, and keep this one still with Thee waking and sleeping. Grant fresh faith, more confidence, more God reliance, that the mind may be kept in perfect peace whose thoughts are stayed on Thee. In Jesus Christ's name we ask it, Amen.