St. Thomas's views on the Immaculate Conception went through three phases.
cf. also ch. 2, art. 2, § "St. Thomas and the Immaculate Conception" of Mother of the Saviour and Our Interior Life by Fr. Réginald Garrigou-Lagrange, O.P.
Phase 1: clear support of it
St. Thomas's clearest support of the Immaculate Conception is in his commentary (1252-6) on Peter Lombard's Sentences (Super Sent., lib. 1 d. 44 q. 1 a. 3 ad 3):
puritas intenditur per recessum a contrario: et ideo potest aliquid
creatum inveniri quo nihil purius esse potest in rebus creatis, si
nulla contagione peccati inquinatum sit; et talis fuit puritas beatae virginis, quae a peccato originali et actuali immunis fuit.
Purity
is increased by withdrawing from its opposite: hence there can be a
creature than whom no more pure is possible in creation, if it be free
from all contagion of sin: and such was the purity of the Blessed Virgin who was immune from original and actual sin.
Phase 2: grappling with it
Summa Theologica III, written in 1272-3, contains the famous question 27 on the Sanctification of the Blessed Virgin, in which he seems to deny the Immaculate Conception.
Phase 3: return to his original position
Explanation of the Lord's Prayer, petition 5 (Lent 1273):
…beatae virgini, quae fuit plena gratiae, in qua nullum peccatum fuit.
…the Blessed Virgin, who was full of grace, in whom there was no sin.
Commentary on Psalm 18 (1272-3):
…beata virgine, quae nullam habuit obscuritatem peccati.
…the Blessed Virgin, who had no darkness of sin.
He preached in his On the Angelic Salutation (Lent 1273):
Ipsa (Virgo) omne peccatum vitavit magis quam alius sanctus, praeter Christum.
Peccatum enim aut est originale, et de isto fuit mundata in utero; aut
mortale aut veniale, et de istis libera fuit. … Sed Christus excellit
beatam virginem in hoc quod sine originali conceptus et natus est.
Beata autem virgo in originali est concepta, sed non nata.
For She Herself avoided every sin, more holy than anyone after Christ.
For sin is either original, and from this she was cleansed in the womb;
or mortal or venial, and from these She was free. … But Christ excelled
the Blessed Virgin in this, that He was conceived and born without
original (sin). Moreover the the Blessed Virgin was conceived in
original (sin), but not born (in it).
The sense of "the Blessed Virgin was conceived in/with original sin (in/cum peccato originali)" is explained by a similar passage of his Compendium Theologiæ cap. 224 ("Sanctification of Christ's Mother")
(1272-3), in which he seems to be referring to Sts. Anne's and
Joachim's sexual act,* not to the Blessed Virgin's participation in
Adam's sin (or lack thereof):
*(cf. St. Augustine's theory that
the propagation of original sin is due to the concupiscence inherent in
the sexual act after the Fall, On Marriage & Concupiscence ch. 27, and this)
Nec solum a peccato actuali immunis fuit, sed etiam ab
originali, speciali privilegio mundata. Oportuit siquidem quod cum
peccato originali conciperetur, utpote quae ex utriusque sexus
commixtione concepta fuit. Hoc enim privilegium sibi soli servabatur ut
virgo conciperet filium Dei. Commixtio autem sexus, quae sine libidine
esse non potest post peccatum primi parentis, transmittit peccatum
originale in prolem. Similiter etiam quia si cum peccato originali
concepta non fuisset, non indigeret per Christum redimi, et sic non
esset Christus universalis hominum redemptor, quod derogat dignitati
Christi. Est ergo tenendum, quod cum peccato originali concepta fuit,
sed ab eo quodam speciali modo purgata fuit.
Mary was
not only free from actual sin, but she was also, by a special privilege,
cleansed from original sin. She had, indeed, to be conceived with
original sin, inasmuch as her conception resulted from the commingling
of both sexes. For the privilege of conceiving without impairment of
virginity was reserved exclusively to her who as a virgin conceived the
Son of God. But the commingling of the sexes which, after the sin of our
first parent, cannot take place without lust,* transmits original sin
to the offspring. Likewise, if Mary had been conceived without original
sin, she would not have had to be redeemed by Christ, and so Christ
would not be the universal redeemer of men, which detracts from His
dignity. Accordingly we must hold that she was conceived with original
sin, but was cleansed from it in some special way.
*(cf. Psalm 50:7: "For behold I was conceived in iniquities; and in sins did my mother conceive me.")
See: