The virial theorem is based on the fact that if we pick any function $f(x,p)$ on phase-space such that it grows slower than linearly during the evolution, then the time-average of its time-derivative must go to zero

$$ \langle \frac{d f}{d t} \rangle_t = \lim_{T\to\infty} \frac{f(x(T),p(T)) - f(x(0),p(0))}{T} = 0$$

With the use of equations of motion we then generally have virial identities of the type

$$\langle \frac{\partial f}{\partial p} \frac{\partial H}{\partial x} \rangle_t = \langle \frac{\partial f}{\partial x} \frac{\partial H}{\partial p} \rangle_t$$

Your example can be generated by $f = xp/2$. The ergodic theorem tells us that if the system is ergodic, we can always (up to cases of measure zero) switch temporal and phase-space averaging.

Now I assume that you are in fact talking about an ensemble of particles placed in the potential $V_2(x)$, some of which will attain energies above $A$. For such particles the virial theorem is generated by the function $f = \sum_i x^i p_i/2$, where $i$ labels the particles. It is now easy to see that every $i$-contribution to $f$ for which the repective particle has energy above $A$ grows asymptotically linearly with time and the virial theorem breaks.

In other words, we can say that the breaking of the virial theorem implies a breaking of ergodicity only when we can guarantee that

$$ \lim_{T\to\infty} \frac{f(x^i(T),p_i(T))}{T} = 0$$