These thoughts were not neccessarily yours; they can come from either your flesh, the world or the enemy. They do not defile you unless you entertain them instead of giving them to God immediately through confession. Cleansing is easy and immediate for each time we fall.
Through this process we will walk in JOY: