Aquinas distinguishes two types of punishment: 1) Simple and 2) Satisfactory. He writes:
[P]unishment can be considered in two ways---simply, and as being satisfactory. A satisfactory punishment is, in a way, voluntary. And since those who differ as to the debt of punishment, may be one in will by the union of love, it happens that one who has not sinned, bears willingly the punishment for another: thus even in human affairs we see men take the debts of another upon themselves. If, however, we speak of punishment simply, in respect of its being something penal, it has always a relation to a sin in the one punished.
He sees satisfaction as a type of pecuniary debt which one can pay for another. He sees simple punishment as that which can only be suffered by the one who committed the crime. He sees the atonement of Christ as the former not the latter. Christ bore a satisfactory punishment, not for His, but for our sins.
In article 8 he asks the question: Whether anyone is punished for another's sin?
If we speak of that satisfactory punishment, which one takes upon oneself voluntarily, one may bear another's punishment, in so far as they are, in some way, one, as stated above. If, however, we speak of punishment inflicted on account of sin, inasmuch as it is penal, then each one is punished for his own sin only, because the sinful act is something personal (emphasis added). But if we speak of a punishment that is medicinal, in this way it does happen that one is punished for another's sin. For it has been stated that ills sustained in bodily goods or even in the body itself, are medicinal punishments intended for the health of the soul. Wherefore there is no reason why one should not have such like punishments inflicted on one for another's sin, either by God or by man; e.g. on children for their parents, or on servants for their masters, inasmuch as they are their property so to speak; in such a way, however, that, if the children or the servants take part in the sin, this penal ill has the character of punishment in regard to both the one punished and the one he is punished for. But if they do not take part in the sin, it has the character of punishment in regard to the one for whom the punishment is borne, while, in regard to the one who is punished, it is merely medicinal (except accidentally, if he consent to the other's sin), since it is intended for the good of his soul, if he bears it patiently.
Aquinas is saying that an innocent may benefit from being punished together with the guilty in a "medicinal way." Somehow the suffering helps the individual to grow spiritually (what some have called "soul-making"). But obviously, this would not apply with regard to Jesus as he was already perfect spiritually and in need of no "medicinal suffering."
This "medicinal suffering" can serve as a deterrent. He writes:
The punishments which human justice inflicts on one for another's sin are bodily and temporal. They are also remedies or medicines against future sins, in order that either they who are punished, or others may be restrained from similar faults.
While Aquinas does not deal specifically with the PST of the atonement, he seems to make it clear that penal suffering can only be inflicted on the guilty. Innocents that have some connection with the guilty parties, as children to parents or slaves to masters, might justly be included in the punishment of the guilty but it is a different type of punishment according to Aquinas.
I think Aquinas was forced to argue for the punishment of the innocent in certain cases because it is found in the OT in the genocides, in the death of the Egyptian firstborn, and so on. In each of these cases, the innocents are connected to the guilty parties in some form. I think this represents what I have called before "collective culpability" which was a part of the ancient mindset. However, for Aquinas punishment, in the sense of penal suffering, could only legitimately be inflicted on the guilty person. If others were also punished along with the guilty, it served some other purpose besides penal suffering.