To Bowler
Whilst baptism was obligatory after the resurrection of Christ, the sacrament was instituted when Christ Himself was baptized:
John 3:22
"After these things Jesus and his disciples came into the land of Judea: and there he abode with them, and baptized."
And St Thomas writes:
As stated above (Question 62, Article 1), sacraments derive from their institution the power of conferring grace. Wherefore it seems that a sacrament is then instituted, when it receives the power of producing its effect. Now Baptism received this power when Christ was baptized. Consequently Baptism was truly instituted then, if we consider it as a sacrament. (Summa Theologica - On Baptism)
Thus the power of this sacrament, removal of all guilt and punishment, was given to the good thief in that he was promised paradise the same day as his death, else purgatory would have fallen to his lot, for want of penance.
This is further attested by St Thomas below. Also the veracity of the baptisms of desire and blood is proven, which deals with your re-iterated question.
As stated above (Question 62, Article 5), Baptism of Water has its efficacy from Christ's Passion, to which a man is conformed by Baptism, and also from the Holy Ghost, as first cause. Now although the effect depends on the first cause, the cause far surpasses the effect, nor does it depend on it. Consequently, a man may, without Baptism of Water, receive the sacramental effect from Christ's Passion, in so far as he is conformed to Christ by suffering for Him. Hence it is written (Apocalypse 7:14): "These are they who are come out of great tribulation, and have washed their robes and have made them white in the blood of the Lamb." In like manner a man receives the effect of Baptism by the power of the Holy Ghost, not only without Baptism of Water, but also without Baptism of Blood: forasmuch as his heart is moved by the Holy Ghost to believe in and love God and to repent of his sins: wherefore this is also called Baptism of Repentance. Of this it is written (Isaiah 4:4): "If the Lord shall wash away the filth of the daughters of Zion, and shall wash away the blood of Jerusalem out of the midst thereof, by the spirit of judgment, and by the spirit of burning." Thus, therefore, each of these other Baptisms is called Baptism, forasmuch as it takes the place of Baptism. Wherefore Augustine says (De Unico Baptismo Parvulorum iv): "The Blessed Cyprian argues with considerable reason from the thief to whom, though not baptized, it was said: 'Today shalt thou be with Me in Paradise' that suffering can take the place of Baptism. Having weighed this in my mind again and again, I perceive that not only can suffering for the name of Christ supply for what was lacking in Baptism, but even faith and conversion of heart, if perchance on account of the stress of the times the celebration of the mystery of Baptism is not practicable."
As stated above (Article 11), the shedding of blood for Christ's sake, and the inward operation of the Holy Ghost, are called baptisms, in so far as they produce the effect of the Baptism of Water. Now the Baptism of Water derives its efficacy from Christ's Passion and from the Holy Ghost, as already stated (11). These two causes act in each of these three Baptisms; most excellently, however, in the Baptism of Blood. For Christ's Passion acts in the Baptism of Water by way of a figurative representation; in the Baptism of the Spirit or of Repentance, by way of desire. but in the Baptism of Blood, by way of imitating the (Divine) act. In like manner, too, the power of the Holy Ghost acts in the Baptism of Water through a certain hidden power. in the Baptism of Repentance by moving the heart; but in the Baptism of Blood by the highest degree of fervor of dilection and love, according to John 15:13: "Greater love than this no man hath that a man lay down his life for his friends."