  This paper represents the completion of our work on the ODE/IM correspondence
for the generalised quantum Drinfeld-Sokolov models. We present a unified and
general mathematical theory, encompassing all particular cases that we had
already addressed, and we fill important analytic and algebraic gaps in the
literature on the ODE/IM correspondence. For every affine Lie algebra
$\mathfrak{g}$ -- whose Langlands dual $\mathfrak{g}'$ is the untwisted
affinisation of a simple Lie algebra -- we study a class of affine twisted
parabolic Miura $\mathfrak{g}$-opers, introduced by Feigin, Frenkel and
Hernandez. The Feigin-Frenkel-Hernandez opers are defined by fixing the
singularity structure at $0$ and $\infty$, and by allowing a finite number of
additional singular terms with trivial monodromy. We define the central
connection matrix and Stokes matrix for these opers, and prove that the
coefficients of the former satisfy the the $QQ$ system of the quantum
$\mathfrak{g}'$-Drinfeld-Sokolov (or quantum $\mathfrak{g}'$-KdV) model. If
$\mathfrak{g}$ is untwisted, it is known that the trivial monodromy conditions
are equivalent to a complete system of algebraic equations for the additional
singularities. We prove a suprising negative result in the case $\mathfrak{g}$
is twisted: in this case, the trivial monodromy conditions have no non-trivial
solutions.
