From Garrigou-Lagrange, OP - Christ the Savior, Ch. XL:
The Teaching Of St. Thomas On The Immaculate Conception
It seems that we must distinguish between three periods in the life of St. Thomas as to his teaching on this subject.
In the first period, which was from 1253 to 1254, he affirmed the privilege, for he wrote: "Such was the purity of the Blessed Virgin Mary, who was exempt from both original and actual sin."
In the second period, St. Thomas sees more clearly the difficulties of the problem, and, because some theologians said that Mary had no need of redemption, the holy Doctor affirms that, according to revelation, Christ is the Redeemer of the human race, and that nobody is saved without him. But giving no thought to preservative redemption, St. Thomas seems to deny the privilege of the Immaculate Conception, saying: "It remains, therefore, that the Blessed Virgin was sanctified after animation," St. Thomas fails to distinguish, as he often does in other questions, between posteriority of nature, which is compatible with the privilege, and posteriority of time, which is incompatible with it. He says: "The Blessed Virgin did indeed, contract original sin," not sufficiently distinguishing between the debt of incurring original sin and the fact of incurring it.
Concerning the question as to the precise moment when the Blessed Virgin was sanctified in the womb, St. Thomas does not come to any conclusion. He only says: "This sanctification took place immediately after her animation," and "it is not known when she was sanctified."
It must be observed with Fathers del Prado, O. P., Mandonnet, O. P., and Hugon, O. P., that the principles invoked by St. Thomas do not contradict the privilege and remain intact if preservative redemption be admitted. But St. Thomas, at least in this second period of his life as teacher, does not seem to have thought of this most perfect mode of redemption. Moreover, it must be noticed that the feast of the Conception of the Blessed Virgin was not as yet celebrated in Rome; but what is not done in Rome, does not appear to be in conformity with tradition.
In the last period of his life, however, from 1272 until 1273, St. Thomas wrote a work that is certainly authentic. In a recent critical edition of this small work made by J. F. Rossi, c. M., we read: "For she [the Blessed Virgin] was most pure because she incurred the stain neither of original sin nor of mortal sin nor of venial sin." If it be so, then St. Thomas at the end of his life, after mature reflection, and in accordance with his devotion toward the Blessed Virgin, again affirmed what he had said in the first period of his life.
We must note other passages indicative of this happy return to his first opinion.
A similar change of opinion is often enough to be found in great theologians concerning very difficult questions that belong to Mariology. First something of the privilege is affirmed in accordance with tradition and devotion; afterward difficulties become more apparent which give rise to doubts, and finally upon more mature reflection, enlightened by the gifts of the Holy Ghost, the theologian returns to his first opinion, considering that God's gifts are more fruitful than we think and there must be good reasons for restricting their scope. But the principles of St. Thomas, as we have observed, do not decide against the privilege, they even lead to it, at the same time as the mind is acquiring an explicit notion of preservative redemption.
Thus St. Thomas probably at the end of life reaffirmed the privilege of the Immaculate Conception. Father Mandonnet and Father J. M. Voste thought so.