St. Thomas Aquinas is very clear that the effect of baptism can be received by desire for the sacrament without it, and also that a man does not necessarily need to receive baptism by water before he dies. Aside from his teaching authority as Doctor of the whole church, his teaching on this matter is also useful to consider because the fathers of the Council of Trent drew heavily from his writings. During the council, St. Thomas's Summa Theologiae was placed on the main altar together with the Holy Bible.
Let us see what St. Thomas has to say:
"In a case of necessity anyone may baptize. And since nowise ought one to sin, if the priest be unwilling to baptize without being paid, one must act as though there were no priest available for the baptism. Hence the person who is in charge of the child can, in such a case, lawfully baptize it, or cause it to be baptized by anyone else. He could, however, lawfully buy the water from the priest, because it is merely a bodily element. But if it were an adult in danger of death that wished to be baptized, and the priest were unwilling to baptize him without being paid, he ought, if possible, to be baptized by someone else. And if he is unable to have recourse to another, he must by no means pay a price for Baptism, and should rather die without being baptized, because for him the baptism of desire would supply the lack of the sacrament."(ST. SS. Q.100 A.2 Ad.2)
Clearly St. Thomas is not talking about being "pre-justified" by desire for the sacrament, and then later receiving it.
"I answer that, The sacrament or Baptism may be wanting to someone in two ways. First, both in reality and in desire; as is the case with those who neither are baptized, nor wished to be baptized: which clearly indicates contempt of the sacrament, in regard to those who have the use of the free-will. Consequently those to whom Baptism is wanting thus, cannot obtain salvation: since neither sacramentally nor mentally are they incorporated in Christ, through Whom alone can salvation be obtained.
Secondly, the sacrament of Baptism may be wanting to anyone in reality but not in desire: for instance, when a man wishes to be baptized, but by some ill-chance he is forestalled by death before receiving Baptism. And such a man can obtain salvation without being actually baptized, on account of his desire for Baptism, which desire is the outcome of "faith that worketh by charity," whereby God, Whose power is not tied to visible sacraments, sanctifies man inwardly. Hence Ambrose says of Valentinian, who died while yet a catechumen: "I lost him whom I was to regenerate: but he did not lose the grace he prayed for."(ST. TP. Q.68 A.2 C.)
Pretty self explanatory.
"The sacrament of Baptism is said to be necessary for salvation in so far as man cannot be saved without, at least, Baptism of desire; "which, with God, counts for the deed" (Augustine, Enarr. in Ps. 57)."(ST. TP. Q.68 A.2 Ad.3)
"So also before Baptism Cornelius and others like him receive grace and virtues through their faith in Christ and their desire[votum] for Baptism, implicit or explicit: but afterwards when baptized, they receive a yet greater fulness of grace and virtues. Hence in Ps. 22:2, "He hath brought me up on the water of refreshment," a gloss says: "He has brought us up by an increase of virtue and good deeds in Baptism."(ST. TP. Q.69 A.4 Ad.2)
I should mention here that St. Thomas says here that one can have an implicit desire[votum] for the sacrament of baptism. Occasionally I run into a person who accepts baptism of desire, but wants to say that it must be explicit, and they argue that because the council of Trent uses the latin word "votum," they had in mind an explicit vow or promise to receive it. While it may be true that they were primarily considering the case of an explicit desire, the word itself is open to both possibilities, as St. Thomas uses it here.
"The Divine power is not confined to the sacraments. Hence man can receive spiritual strength to confess the Faith of Christ publicly, without receiving the sacrament of Confirmation: just as he can also receive remission of sins without Baptism. Yet, just as none receive the effect of Baptism without the desire of Baptism; so none receive the effect of Confirmation, without the desire of Confirmation. And man can have this even before receiving Baptism." (ST. TP. Q.72 A.6 Ad.2)
"And it has been said above (Q68, A2), that before receiving a sacrament, the reality of the sacrament can be had through the very desire of receiving the sacrament. Accordingly, before actual reception of this sacrament, a man can obtain salvation through the desire of receiving it, just as he can before Baptism through the desire of Baptism, as stated above (Q68, A2)."(ST. TP. Q.73 A.3 C.)
"As stated above (Q73, A3), the effect of the sacrament can be secured by every man if he receive it in desire, though not in reality. Consequently, just as some are baptized with the Baptism of desire, through their desire of baptism, before being baptized in the Baptism of water; so likewise some eat this sacrament spiritually ere they receive it sacramentally. Now this happens in two ways. First of all, from desire of receiving the sacrament itself, and thus are said to be baptized, and to eat spiritually, and not sacramentally, they who desire to receive these sacraments since they have been instituted." (ST. TP. Q.80 A.1 Ad.3)
"Wherefore for the remission of both actual and original sin, a sacrament of the Church is necessary, received either actually, or at least in desire, when a man fails to receive the sacrament actually, through an unavoidable obstacle, and not through contempt. Consequently those sacraments which are ordained as remedies for sin which is incompatible with salvation, are necessary for salvation: and so just as Baptism, whereby original sin is blotted out, is necessary for salvation, so also is the sacrament of Penance." (Suppl. Q.6 A.1 Ad.1)
Notice here that St. Thomas says Baptism is necessary for salvation, but he does not mean by it what the heretics do who deny baptism of desire. In fact, he says that it is necessary as penance also is. However, it is clear that the sacrament of penance does not need to be actually received, but can be received in desire only; the council of Trent makes this very clear.
"It is clear that the Holy Spirit is God, since he says, unless one is born again of water and the Holy Spirit (ex aqua et Spiritu Sancto). For above (1:13) he says: "who are born not from blood, nor from the desires of the flesh, nor from man's willing it, but from God (ex Deo)." From this we can form the following argument: He from whom men are spiritually reborn is God; but men are spiritually reborn through the Holy Spirit, as it is stated here; therefore, the Holy Spirit is God.
445 Two questions arise here. First, if no one enters the kingdom of God unless he is born again of water, and if the fathers of old were not born again of water (for they were not baptized), then they have not entered the kingdom of God. Secondly, since baptism is of three kinds, that is, of water, of desire, and of blood, and many have been baptized in the latter two ways (who we say have entered the kingdom of God immediately, even though they were not born again of water), it does not seem to be true to say that unless one is born again of water and the Holy Spirit, he cannot enter the kingdom of God.
The answer to the first is that rebirth or regeneration from water and the Holy Spirit takes place in two ways: in truth and in symbol. Now the fathers of old, although they were not reborn with a true rebirth, were nevertheless reborn with a symbolic rebirth, because they always had a sense perceptible sign in which true rebirth was prefigured. So according to this, thus reborn, they did enter the kingdom of God, after the ransom was paid.
The answer to the second is that those who are reborn by a baptism of blood and fire, although they do not have regeneration in deed, they do have it in desire. Otherwise neither would the baptism of blood mean anything nor could there be a baptism of the Spirit. Consequently, in order that man may enter the kingdom of heaven, it is necessary that there be a baptism of water in deed, as in the case of all baptized persons, or in desire, as in the case of the martyrs and catechumens, who are prevented by death from fulfilling their desire, or in symbol, as in the case of the fathers of old." (Commentary on the Gospel of St. John, Chapter 3, Lecture 1)
This is an extremely instructive passage from St. Thomas's commentary on the Gospel of John, which I have included for the benefit of those who are wish to interpret the passage "unless one is born again of water, etc." in such as way as to exclude baptism of desire.
"We should say, therefore, that the sacrament of baptism is necessary for everyone, and it must be really received, because without it no one is born again into life. And so it is necessary that it be received in reality, or by desire in the case of those who are prevented from the former. For if the contempt within a person excludes a baptism by water, then neither a baptism of desire nor of blood will benefit him for eternal life. " (Commentary on the Gospel of St. John, Chapter 6, Lecture 7)
Notice that St. Thomas is very clear that Baptism is necessary for salvation, but it can be received in desire, and this suffices for salvation. In fact, he says that some have "entered the kingdom of God immediately," even though they did not receive baptism by water. This alone is enough to show that St. Thomas most certainly would not agree with the Feeneyite position.