In order for a sin to be an actual mortal sin, the type of sin that deprives one of the state of grace and deserves eternal punishment, three things are needed:
- grave matter – the act must be incompatible with the love of God and the love of neighbor as self; it must be an act so thoroughly morally disordered as to deserve the loss of grace and the punishment of Hell (if one does not repent).
The passing thought that you described is not grave matter (according to your description).
- full knowledge of the grave immorality of the act.
- full deliberation (a full and free choice of the will) – a passing brief thought generally would not have fullness of deliberation.
Saint Thomas Aquinas: “Therefore when the soul is so disordered by sin as to turn away from its last end, viz. God, to Whom it is united by charity, there is mortal sin; but when it is disordered without turning away from God, there is venial sin.”[1]
Pope John Paul II: “And when through sin, the soul commits a disorder that reaches the point of turning away from its ultimate end, God, to which it is bound by charity, then the sin is mortal; on the other hand, whenever the disorder does not reach the point of a turning away from God, the sin is venial. For this reason venial sin does not deprive the sinner of sanctifying grace, friendship with God, charity and therefore eternal happiness, whereas just such a deprivation is precisely the consequence of mortal sin.”[2]
[1] St. Thomas Aquinas, Summa Theologica, I-II, Q. 72, A. 5.
[2] Pope John Paul II, Reconciliation and Penance, n. 17.