For St. Thomas, these are the fears that "make us turn... to God or away from Him."
He calls the fear that prompts rejecting God "worldly." The people who overcome this fear most spectacularly would then be Christian martyrs. But as a general rule, there are "certain things, viz. sinful deeds, which no fear should drive us to do, since to do such things is worse than to suffer any punishment whatever."
The fears through which we are turned toward God are of punishment (by God) and of fault.
Regarding fear of punishment by worldly authorities, St. Thomas argues that when justice is preserved, "the secular power inflicts punishment by acting as God's minister." The same presumably is true for a priest when he imposes penance for a confessed sin. This, too, is indirect fear of punishment by God. Moreover, love of neighbor ought not to take precedence over love of God; thus, in cases where the good of neighbor and justice toward God are in opposition, the latter is to be preferred. As a result, fear of temporal evils must not eclipse regard and love for God. In other words, if love of worldly goods exceeds love for God, then of course, the fear of losing these goods will exceed the fear of losing God's friendship or grace. And that is considerably perverse and wicked.
The standard Biblical example of worldly fear is Peter denying Christ.
This, incidentally, is how St. Thomas distinguishes between fear of punishment as such and "servile" fear of punishment. Fear of punishment is perfectly good and useful even if admittedly rather primitive and painful. Servility becomes attached to fear when "the good to which the punishment is contrary is loved as the last end, and consequently the punishment is feared as the greatest evil." Then the influence of fear is at least greater than that of charity; more likely even that one is then "devoid of charity" entirely. But fear of punishment is compatible with charity when "the punishment is directed to God as its end, and consequently is not feared as the greatest evil." A man is then a slave when he "loves not justice, and fears nothing but the punishment."
Interestingly, St. Thomas argues that it is only proper to love God as an end; loving God as a means to worldly goods is "mercenary love" and "always evil." But can the two loves coexist? Isn't thanksgiving for some success entirely proper?
Another problem with servile fear is that it may lead to despair, as punishment sometimes can be considerable. On the other hand, as long as there's charity, there is hope even under great penance which we know some saints have experienced.
Further, if God is viewed as the cause of punishment and is not loved, the evil of the effect might seep into the perception of the cause. Now God does no evil to anyone absolutely, but evil may come from Him (or His "ministers" as noted above) relatively as part of the good of dispensing justice. So, hating God for punishment might not be the worst sin, insofar as the person is operating under a defective concept of God and so is hating an illusion. It's a bit like hating cops for doing their job well: a futile and absurd emotion.
Finally, there are 3 effects of sin, according to St. Thomas: corruption of nature, debt of punishment, and stain on the soul. (ST, II-I, 85-87) Moreover, he writes that "separation from God is a punishment." So, all 3 of these types of consequences, not just the penance, are to be feared.
Filial fear, on the other hand, is fear "whereby a son fears to offend his father or to be separated from him." As one's will straightens out and one wants to be good, fear of punishment diminishes. If one has no interest of committing crimes, why should he (under ideal circumstances which God certainly represents) be afraid of the authorities? On the other hand, the will directed toward righteousness loves God more and more and so fears of offending Him ever more fervently. Thus, St. Thomas argues that charity diminishes servile and increases filial fear, the former "because one thinks less of his own [temporal] good to which punishment is opposed; secondly, because the faster he clings, the more confident he is of the reward, and consequently the less fearful of punishment."
There is a slight inconsistency here: are corruption of nature and stain on the soul objects of servile or filial fear? Perhaps the stain or privation of grace belongs to filial fear, while corruption of nature is a kind of fear of failure. I mean that an athlete is rightfully afraid of injuring himself during exercise or training: not only is an injury more probable for him than for an average fat slob, but it is likely to be more severe and further can prevent him from competing or performing in the future. Similar reasoning applies to a spiritual warrior: he does not want to corrupt his soul as a natural consequence of sin. The fat slob in this case would be someone so afraid of evil than he refuses to do good; the athlete would be someone committed to mastering the flesh, the world, and the devil who, through this daring, is more exposed to adversity and is in greater danger.
There is another reason why filial fear gets stronger with charity. Grace builds upon nature as its foundation. Imagine then Smith's soul as a palace beautiful from bottom (nature) to the top (grace). Even a single mortal sin can demolish the palace or at least ruin its loveliness, which is a far greater tragedy inspiring indeed a far greater fear than the destruction of Jones' rickety shack of a personality.
Regarding the problem of whether fear remains in heaven, I think the capacity to feel fear remains as part of human nature. But neither servile nor filial fear nor fear of failure will actually in the state of glory ever be felt.
I disagree with St. Thomas on whether fear is the beginning of wisdom. On the contrary, fear of the law is the fruit of "wisdom" and "charity." A fully fearless man is a mad dog, subhuman. Some recognition of what sort of creature he and fellow men are (wisdom) coupled with a absence of hatred for others (charity) produces fear of consequences of harming other people. However, it is true that only minimal wisdom and charity are required to yield fear that humanizes a man; on which all further developments of personality, including improvements in wisdom and charity, rest.