I know where you are coming from. It happened to me in the past, and sometimes it still happens, as far as in my mind. It pops in before I know it. I don't want to do it, and I know that God knows that. I have genuine repentance (I hate it) and I have godly sorrow (I know it hurts God).
Has God directed you to do anything specific? It may be that because you are ashamed and don't want to share with someone you know that you still haven't conquered it. There is good to be found with accountability. If you talk about it with a trusted, godly friend or a biblical counselor or a pastor, you are held accountable when they ask how you are doing. Let the Light shine on this issue for you, and perhaps that is the break in the stronghold for you.
We can control our thoughts.
2 Corinthians 10: 5 We demolish arguments and every pretension that sets itself up against the knowledge of God, and we take captive every thought and make it obedient to Christ.
God is really good, because He does more than tell us not to do something. He shows us ways to change. Replace a bad habit with a good one.
Ephesians4: 29 Do not let any unwholesome talk come out of your mouths, but only what is helpful for building others up according to their needs, that it may benefit those who listen.
Okay, I know you're not speaking it, but you are hearing it (in your mind.) So when a curse comes to mind, think what caused it. Did a person cause it? A situation? Be specific with yourself. And when you have determined what it was, ask forgiveness from God for it. At this point, take the time to replace that curse with a praise or an encouragement, even if it's only for your own listening. Did someone cut you off on the road? If you cussed, repent, ask forgiveness, and say, possibly out loud, "Thank You, Lord, that You protected me and I didn't get hit." Now you are focusing on the good.
Philippians 4: 8 Finally, brothers, whatever is true, whatever is noble, whatever is right, whatever is pure, whatever is lovely, whatever is admirable--if anything is excellent or praiseworthy--think about such things.