score:5
This answer is necessarily a bit long, because it requires some background. Skip ahead to "Gifts of the Holy Spirit" to skip the background.
It is not exactly charity that perfects the virtues into the Gifts of the Holy Spirit, but the Holy Spirit Who gives the Gifts to those who are disposed to receive them.
Some background
Aquinas essentially assumes Aristotle's doctrine regarding virtue and vice. Simplifying the topic a little, virtues and vices are kinds of "habits" (Latin: habitus, Greek ἕξεις); that is, stable dispositions of a person that help him to perform various kinds of actions: if the habitus tends to make one act morally well, then it is a virtue; if evilly, then it is a vice. For Aristotle (as for Aquinas), these habitus are acquired by means of deliberately performing the corresponding actions.
For example, suppose I find $20 sitting on my desk that I know belongs to my co-worker. The first time it happens, perhaps I am tempted to pocket the $20 bill quietly, even though I know it is stealing. However, I decide to do the honest thing and give it back to my co-worker. Aquinas would argue that by doing that, I make it easier for myself to do the right thing the next time; he would say that I am forming the virtue of honesty, which is a species of justice. (On the other hand, if I pocket the money, I make it easier for myself to steal the next time, thus forming the vice of dishonesty.)
In other words, acting morally (or immorally) produces a kind of "residue" in the person who acts—the virtue or the vice—that makes it easier for him to act the same way in the future. (Aquinas' description of habitus is to be found in Summa Theologiae Ia-IIae, qq. 49-89, especially qq. 55, Article 4, and 71.)
Traditionally, the human virtues are divided into four "species" or "cardinal virtues" (also called "moral virtues"): prudence, justice, fortitude, and temperance.
All this, for Aquinas, occurs on the "natural" level, not yet considering the order of grace; that is, the "supernatural" level, that builds upon and perfects the natural.
Once we enter the domain of grace, we have to take into account the action of God (attributed to the Holy Spirit) in our souls. It is not only our actions that leave a "residue" (habit) in our souls, but the action of God.
It is through God's action alone that we can know Him (through faith) and love Him (though hope and charity). Faith, hope, and charity are called "theological" virtues because God is both their origin and their object. (See Summa theologiae, Ia-IIae, q.62.) However, God also perfects our moral life, infusing moral ("cardinal") virtues that bear the same names as the corresponding "natural" virtues (prudence, justice, fortitude, and temperance), but which have God as their origin, not our actions (q. 61).
Charity is indeed the queen of the virtues because in it all the other virtues find their perfection. (We believe and hope in order to love God and neighbor; justice is the minimum required, so to speak, for charity; in order to apply charity here and now, we need prudence; and so on.)
Gifts of the Holy Spirit
Here is where the Gifts of the Holy Spirit come in. (See q. 68.) The virtues (both natural and infused) have the function of properly disposing our souls to the action of the Holy Spirit. Notice, however, that the exercise of these virtues, even the theological virtues, requires an action on our part.
(The infused virtues, however, come from God. That does not mean that our actions are indifferent, just that these virtues come about thanks to God's gratuitous gift, not by means of our effort. The "natural" virtues, on the other hand, do come about through our own efforts.)
A properly disposed soul, however, can receive additional motions from the Holy Spirit that do not require a direct intervention on our part; rather they come to us by divine inspiration (as Aquinas calls it). These are the Gifts of the Holy Spirit.
The difference between the Gifts and the virtues is that it is man who exercises the virtues (even though they come from God); but God who exercises the Gifts.
In summary, to answer your original question, it is not that charity perfects the virtues into the Gifts. Rather, it is the Holy Spirit who infuses the Gifts into someone. He does so when the person has sufficiently disposed his soul by practicing charity (and hence all the other infused virtues).
We could say that the gift of Wisdom is the perfection of charity: it presupposes charity, but through Wisdom, the Holy Spirit moves a man beyond what he could do only with the virtue of charity.