Perfect contrition effects forgiveness of mortal sin as soon as that contrition is made by the sinner. The sin is forgiven and sanctifying grace is restored to his soul before he goes to Confession. This would not be the case with imperfect contrition.
1452 When it arises from a love by which God is loved above all else, contrition is called “perfect” (contrition of charity). Such contrition remits venial sins; it also obtains forgiveness of mortal sins if it includes the firm resolution to have recourse to sacramental confession as soon as possible.
**1453
The contrition called “imperfect” (or “attrition”) is also a gift of God, a prompting of the Holy Spirit. It is born of the consideration of sin’s ugliness or the fear of eternal damnation and the other penalties threatening the sinner (contrition of fear). Such a stirring of conscience can initiate an interior process which, under the prompting of grace, will be brought to completion by sacramental absolution. By itself **however, imperfect contrition cannot obtain the forgiveness of grave sins, but it disposes one to obtain forgiveness in the sacrament of Penance
vatican.va/archive/ENG0015/__P4D.HTMThe words “By itself” are critical. In other words, just making an act of imperfect contrition will not automatically restore one to the state of sanctifying grace (as an act of perfect contrition does). Forgiveness can be obtained in Confession — but note the teaching does not say that is the ONLY possible way that God can/will be merciful and grant forgiveness. You are reading “only” into the teaching. (The person in the example had received that grace of wanting to obtain forgiveness in the sacrament of Penance. Who are we to declare how God will judge him – especially since he accepted that grace and was acting upon it?)
1861 Mortal sin is a radical possibility of human freedom, as is love itself. It results in the loss of charity and the privation of sanctifying grace, that is, of the state of grace. If it is not redeemed by repentance and God’s forgiveness, it causes exclusion from Christ’s kingdom and the eternal death of hell, for our freedom has the power to make choices for ever, with no turning back.
However, although we can judge that an act is in itself a grave offense, we must entrust judgment of persons to the justice and mercy of God.
vatican.va/archive/ENG0015/__P6C.HTM