The modern definition of thermodynamic stability is the state of maximum entropy.
Some background information is necessary to make sense of this. I hope you will find the following helpful!
Phenomenologically, thermodynamic stability is the absence of visible change. This is the 'original' definition, employed by experimentalists during the 18th and 19th centuries. If repeated observations of your system - such as measurements of its temperature, pressure, density, colour, etc - don't indicate any change, you can tentatively regard it as stable.
Why tentatively? Because as you've alluded to, some changes can be tortuously slow, so unstable systems can appear stable because the intervals between each observation are fleeting by comparison with the system's rate of change. Such states are called 'metastable'.
The existence of metastable states severely limits the scope of this observational-based definition of stability. A more fundamental definition, that can distinguish between truly stable and merely metastable states is clearly desirable. This alternative, quantitative approach, involves measuring the energy changes that accompany different chemical reactions. This is a tricky process, because the differnet forms of energy transfer accompanying any reaction can be are numerous: heat (thermal conduction); work (exertion of a force or pressure); current (transfer of charge across an electrical potential); to name the most common ones. The basis of this approach is that chemical compounds store energy in their bonds, so by tabulating the energy changes associated with many different reactions, their capacities for storing energy can be calculated.
But remember! The defining property of energy is that it is conserved! A table of bond energies such as that described above cannot by itself function as an indicator of stability. A final step is needed, which is to identify a particular form of energy that is minimized by all chemical reactions, and which will therefore be amenable to the kind of 'potential well' analysis described in the linked answer by Thomij. This form, commonly called 'Gibbs energy', is the energy associated with a change in entropy. It's the increase of entropy that is the true driver of spontaneous processes. Accordingly, the condition of maximum stability for a chemical system is defined by the maximization of its entropy.
What is entropy?
Entropy is a measure of how the energy in a system is distributed among it's constituent particles. More statistically probable distributions have higher entropy. The most probable distribution has the highest entropy. Entropy is often described as a measure of disorder, although I personally find this exposition misleading. Entropy is a subtle and unnerving concept, which whole books have been written about, and which I've taken literally years to make peace with. The best text I can recommend is 'The Second Law' by Henry Bent.
What do you mean by 'the energy associated with an increase of entropy'?
Transfers of energy always accompany some other change, such as an increase in volume, or a flow of current, or a transfer of mass. Indeed, the 'forms' of energy familiar from high school are defined by the nature of their accompanying change (e.g. 'work of expansion' energy is that accompanying the exertion of a pressure, and thereby an increase in volume). An increase in entropy is simply another (admittedly more obscure) example of this. But you can think of entropy as a property somewhat analogous to volume, in the sense of being a feature of a system that can be changed by the application of a particular form of energy. In the case of entropy, the corresponding 'form' of energy is heat, rather than work. As alluded to here, there is a very close connection between temperature and entropy; in fact, a definition of temperature is the limiting ratio between the heat supplied to a system and the change in entropy that results.