St. Thomas did no such thing.
Some say that the vital functions observed in the embryo are not from its soul, but from the soul of the mother; or from the formative power of the semen. Both of these explanations are false; for vital functions such as feeling, nourishment, and growth cannot be from an extrinsic principle. Consequently it must be said that the soul is in the embryo; the nutritive soul from the beginning, then the sensitive, lastly the intellectual soul. (St. Thomas, Summa theologiae I q. 118 a. 2)
I believe it was in the Commentary on the Book of Sentences where he stated the number of days for a soul to enter the embryo was 40 days for a male and 90 days for a female. I will try to find the source for you, but I know it wasn't in the Summa where he stated the belief.