St Thomas must have done penance as implied by his prayer as follows:
Prayer of St Thomas Aquinas
To the Most Blessed Virgin Mary
O most blessed and sweet Virgin Mary,
Mother of God, filled
with all tenderness,
Daughter of the most high King, Lady of the angels, Mother of all the
faithful, on this day
and all the days of my life, I entrust to your
merciful heart my body and my soul, all my
acts, thoughts, choices, desires, words, deeds, my
entire life and death, so that, with your
assistance, all may be ordered to the good according to the will of your beloved Son, our Lord Jesus Christ.
Be to me, my most holy Lady, a comfort and an ally
against the stratagems and traps
of the ancient enemy and of all those
who harbor ill intentions against me.
From your beloved Son, our Lord Jesus Christ,
request for me the grace to resist firmly
the temptations of the world, the flesh, and
the devil, and a constant resolve to sin no
more and to persevere in your service
and the service of your beloved Son.
My most holy Lady, I also beseech you to obtain
for me true obedience and true humility
of heart so that I may recognize myself
truly as a sinner—wretched and weak—and
powerless, without the grace and help of my
Creator and without your holy prayers, to do
any kind of good work or even to
resist the unrelenting assaults of evil.
Procure for me also, O my
most sweet Lady, perpetual purity of mind and body, so that
with a pure heart and chaste body I may be
strengthened to serve you and your beloved
Son through the Dominican Order.
From Him, obtain for me a spirit of poverty
willingly accepted with patience and
tranquility of mind, so that I
will have the strength to sustain the labors of this Order and
to work for my own salvation and that of my neighbors.
Obtain for me as well, O most sweet Lady, true
charity with which from the depths of my
heart I may love your most holy Son, our Lord Jesus Christ, and,
after Him, love you
above all other things, and love my
neighbor in God and because of God.
Thereby may I rejoice in his goodness, sorrow
over his evils, despise no one, never judge
rashly, and never in my
heart exalt myself over anyone.
Grant, O Queen of Heaven, that ever in my
heart I may have fear and love alike for your
most sweet Son; That I may
always give thanks for the
many blessings bestowed upon
me not for my merits but by His kindness;
And that I may ever make a pure and sincere
confession and do true penance for my sins, in
order that I might
deserve to obtain His
mercy and grace.
I pray also that, at the end of my life, you,
Mother without compare, Gate of Heaven, and
Advocate of sinners, will not allow me, your
unworthy servant, to stray from the holy
Catholic faith but that you will protect me
with your great piety and mercy, defend me
from evil spirits, and obtain for me, through
the blessed and glorious Passion of your Son
and through your own intercession, received in
hope, the forgiveness of all of my sins.
When I die in your love and His love, may you
direct me into the way of salvation and
blessedness. Amen.