The quasiharmonic approximation (QHA), in its simplest form also called the statically constrained (SC) QHA, has been shown to be a straightforward method to compute thermoelastic properties of crystals. Recently we showed that for non-cubic solids SC-QHA calculations develop deviatoric thermal stresses at high temperatures. Relaxation of these stresses leads to a series of corrections to the free energy that may be taken to any desired order, up to self-consistency. Here we show how to correct the elastic constants obtained using the SC-QHA. We exemplify the procedure by correcting to first order the elastic constants of MgSiO$_3$-perovskite and MgSiO$_3$-post-perovskite, the major phases of the Earth's lower mantle. We show that this first order correction is quite satisfactory for obtaining the aggregated elastic averages of these minerals and their velocities in the lower mantle. This type of correction is also shown to be applicable to experimental measurements of elastic constants in situations where deviatoric stresses can develop, such as in diamond anvil cells.