Now, it would not be a sin at all if someone were to say to God fearfully, humbly, and devoutly: "Why didst thou make me thus?" Even if he would blaspheme God while under the overwhelming power of an assualt upon his faith, he would not perish because of this. For our God is no impatient or cruel God, even toward the ungodly. I say this in order to comfort those who are constantly plagued by blasphemous thoughts and are in very great trepidation. Indeed, because it is the devil that forcibly extorts such blasphemies from men against their will, they are sometimes more agreeable to God than the sound of a hallelujah or an anthem of praise. For the more horrible and horrid a blasphemy is, the more agreeable it is to God if only the heart feels that it does not want to utter it, because it has not freely brought it forth from itself. If a man is filled with fear and trembling because he has uttered a blasphemy, this is a sign that he did not really want to do it and that he did it innocently. This dread of evil is an evident sign that one has a good heart. Hence, the best cure for such thoughts is not be be concerned about them.
-- Martin Luther
Lectures on Romans