Thomas says that a heretic, if he deny some one doctrine of the Church, does not have faith in the rest of the Church's teachings. He may think he believes in all the rest, but since he has knowingly denied one doctrine, then all the rest of the Church's doctrines are believed by him only because they happen to coincide with his personal opinions. Faith as a gift from God to accept the teachings of revelation was lost upon the knowing denial of one dogma, therefore agreement on the rest of the dogmas is only happenstance, and no longer true faith.
An example. Joe is baptized a Catholic and considers himself as such. He believes everything the Church proposes for belief, except the doctrine of keeping holy the Lord's day. Joe does not think he needs to go to Mass on Sunday and has convinced himself that the Church teaching on this matter is overly strict and he chooses not to go. Joe may believe everything else the Church teaches - the nature of Christ, the power of the Sacraments, the moral teachings on marriage and business ethics, and all else. He agrees with 99% of the required doctrines. Per Aquinas Joe does not have faith. Joe holds a whole series of personal opinions that, as luck would have it, happen to match the teachings of the Church. Essentially Joe has set up a new Church, the "Church of Joe". This new church is almost indistinguishable from the Catholic Church, except in one important aspect - Sunday duty.
Thomas distinguishes between knowing denial of a doctrine, what he calls obstinate denial, and someone who may just be mistaken about some teaching of the Church, this person is in error, but is not an obstinate heretic.
By this criteria many Catholics are attending their own personal Churches that look and feel a lot like the Catholic Church. These may deny that the Church teaching on contraception for example is binding, but still accept nearly all other doctrines. They are members of the church of Mary, Jane, and Steve. They do not cease to be members of the Catholic Church due to their baptism, but they have lost the gift of faith, and only happen to agree with the Catholic Church's teaching because they match their opinions.
Thomas words it this way in the Summa Theologica, II-II q5 a3:
Article 3. Whether a man who disbelieves one article of faith, can have lifeless faith in the other articles?
Objection 1. It would seem that a heretic who disbelieves one article of faith, can have lifeless faith in the other articles. For the natural intellect of a heretic is not more able than that of a catholic. Now a catholic's intellect needs the aid of the gift of faith in order to believe any article whatever of faith. Therefore it seems that heretics cannot believe any articles of faith without the gift of lifeless faith.
Objection 2. Further, just as faith contains many articles, so does one science, viz. geometry, contain many conclusions. Now a man may possess the science of geometry as to some geometrical conclusions, and yet be ignorant of other conclusions. Therefore a man can believe some articles of faith without believing the others.
Objection 3. Further, just as man obeys God in believing the articles of faith, so does he also in keeping the commandments of the Law. Now a man can obey some commandments, and disobey others. Therefore he can believe some articles, and disbelieve others.
On the contrary, Just as mortal sin is contrary to charity, so is disbelief in one article of faith contrary to faith. Now charity does not remain in a man after one mortal sin. Therefore neither does faith, after a man disbelieves one article.
I answer that, Neither living nor lifeless faith remains in a heretic who disbelieves one article of faith.
The reason of this is that the species of every habit depends on the formal aspect of the object, without which the species of the habit cannot remain. Now the formal object of faith is the First Truth, as manifested in Holy Writ and the teaching of the Church, which proceeds from the First Truth. Consequently whoever does not adhere, as to an infallible and Divine rule, to the teaching of the Church, which proceeds from the First Truth manifested in Holy Writ, has not the habit of faith, but holds that which is of faith otherwise than by faith. Even so, it is evident that a man whose mind holds a conclusion without knowing how it is proved, has not scientific knowledge, but merely an opinion about it. Now it is manifest that he who adheres to the teaching of the Church, as to an infallible rule, assents to whatever the Church teaches; otherwise, if, of the things taught by the Church, he holds what he chooses to hold, and rejects what he chooses to reject, he no longer adheres to the teaching of the Church as to an infallible rule, but to his own will. Hence it is evident that a heretic who obstinately disbelieves one article of faith, is not prepared to follow the teaching of the Church in all things; but if he is not obstinate, he is no longer in heresy but only in error. Therefore it is clear that such a heretic with regard to one article has no faith in the other articles, but only a kind of opinion in accordance with his own will.
Reply to Objection 1. A heretic does not hold the other articles of faith, about which he does not err, in the same way as one of the faithful does, namely by adhering simply to the Divine Truth, because in order to do so, a man needs the help of the habit of faith; but he holds the things that are of faith, by his own will and judgment.
Reply to Objection 2. The various conclusions of a science have their respective means of demonstration, one of which may be known without another, so that we may know some conclusions of a science without knowing the others. On the other hand faith adheres to all the articles of faith by reason of one mean, viz. on account of the First Truth proposed to us in Scriptures, according to the teaching of the Church who has the right understanding of them. Hence whoever abandons this mean is altogether lacking in faith.
Reply to Objection 3. The various precepts of the Law may be referred either to their respective proximate motives, and thus one can be kept without another; or to their primary motive, which is perfect obedience to God, in which a man fails whenever he breaks one commandment, according to James 2:10: "Whosoever shall . . . offend in one point is become guilty of all."