You use the expression ‘In the Heat of the Moment’ to indicate that you’ve said or done something without thinking because you were feeling angry or excited.
Example of use: “I’m afraid I was very rude; I was caught up in the heat of the moment.”
The origin of the phrase ‘in the heat of the moment’ is not known; it became popular late in the 20th century.