Aquinas's classification of the virtues is based on a sort of mereological analysis. Every virtue has quasi-integral parts, subjective parts, and potential parts. A quasi-integral part of a major virtue is another virtue that belongs to the essence of the major virtue. In effect, quasi-integral parts are minor virtues that are needed for the major virtue. So, for instance, the virtue of avoiding evil is a quasi-integral part of justice. It is a virtue covering part of what justice covers, and part of the very nature of justice is to organize it with other virtues. A subjective part of a virtue is a species of that virtue in a particular domain that requires it to have a distinctive way of going about things. So, for instance, there might be a kind of fortitude suitable for military valor and a kind of fortitude suitable for everyday life, and these are subjective parts of fortitude. Each of these would be wholly fortitude, having the full proper nature of fortitude, but in each case specialized for a particular set of circumstances. And a potential part is an ancillary virtue that is closely related to a major virtue but does not have exactly the same nature. For instance, justice in the strict sense is about rendering what is due to others in an equal exchange; most of the potential virtues for justice have to do with rendering what is due to others in an unequal exchange -- for instance, piety renders what is due to our parents or country, and religion renders what is due to God. These virtues can be considered justice in a broad sense; but justice in a broad sense is not a single virtue but a family of resembling virtues.
This background is useful for understanding today's virtue, which is solertia, often translated as shrewdness or quickwittedness or ingenuity; and one can't talk about solertia without talking about its relations to prudence and to eustochia, the virtue that has to do with good guessing (happy conjecture, as it is sometimes described). The terms come from Aristotle's discussion of practical wisdom or prudence. Prudence has to make inferences about many things; and inferences require means of inferences (middle terms in syllogisms, for instance). Thus the ability to give an educated guess about what path we should take to draw a good conclusion is an important one for prudence.
Thomas Aquinas shifts his views about solertia over time. In early works like the commentary on the Sentences, Aquinas argues that solertia and eustochia are potential parts of prudence: they could be considered prudence in a broad sense, but they have quirks that make them different from prudence in a strict sense. In this conception, solertia is the disposition that lets you very quickly find the means of inference in any matter, whether practical or speculative, whether necessary or contingent; while eustochia is the disposition that lets you very reliably find the means of inference in contingent matters.
Later, however, having read the Nicomachean Ethics more closely, and particularly by being influenced by the commentary of Andronicus of Rhodes, he came to the conclusion that it would be more consistent with the general count of prudence and with Aristotle's terminology to think of eustochia or ingenuity, now understood as simply the virtue of happy conjecture under any circumstances, and solertia is a subjective part of eustochia, namely, the kind of eustochia that finds means of inference very quickly and easily. Solertia is also a quasi-integral part of prudence. This is the position he takes in Summa Theologiae 2-2.49.4, quoting Andronicus: "Solertia is a disposition by which what is appropriate is rapidly discovered."
The reason for treating solertia as a quasi-integral part of prudence is that prudence concern gives us good judgments about practical matters; these good judgments need to be reached by inferences, and there are two ways one can facilitate inference to good judgment. One way is by getting help, and the virtue that deals with this is docilitas, teachableness; but the other way is by learning how to hypothesize, conjecture, and guess in reasonably reliable ways. This needs a name, and the most convenient name was solertia, which Andronicus had already insisted was a part of prudence. This makes it possible to use the name 'eustochia' for the more general virtue concerned with conjecture, which it fits better, anyway.
So there is a virtue of good guessing, called eustochia. More precisely, eustochia is the developed disposition to swift and likely conjecture or hypothesis, the aptitude for rapid discovery of congruities and incongruities. Not all conjectures, of course, are equal, and there is one form of conjecture that makes eustochia an especially interesting virtue. Reasoning, as we know, proceeds from a starting point to a terminal point, but it can't just be a series of stages. "The switch was flipped; the light must have gone on" is not an inference or bit of reasoning; it's just a series of claims. Reasoning or inference generally requires that we move from one claim to another by something conjoining them, whether explicit or not; this is called the middle term, and it's simply the means of getting from premise to conclusion. Thus, in "The switch was flipped, so the light must have gone on" there is an implicit middle term (or series of middle terms, it makes little difference) that links flipping the switch with the light going on. This middle term is the means of drawing a conclusion from the original premises or data. Eustochia is the virtue of being good at hypothesizing a middle term; and solertia is eustochia for practical circumstances, and something required for making prudent decisions.