I've got myself confused about a basic question. If we have a gauge-invariant operator $\mathcal{O}$ whose expectation value is \begin{equation} \left\langle\mathcal{O}\left(x_1, \ldots, x_n\right)\right\rangle=\frac{1}{Z[0]} \int \mathcal{D} \bar{\psi} \mathcal{D} \psi \exp \left[i \int d^4 x i \bar{\psi} \not \partial \psi\right] \mathcal{O}\left(x_1, \ldots, x_n\right), \end{equation} then it ought to be invariant under a phase transformation \begin{equation} \psi(x) \rightarrow e^{i \alpha(x)} \psi(x) , \end{equation} since the path integral sums over all field configurations then it must be invariant under this. In fact the conservation of currents comes from expanding this in $\alpha(x)$ giving: $$ 0=\frac{1}{Z[0]} \int d^4 z \alpha(z) \int \mathcal{D} \bar{\psi} \mathcal{D} \psi \exp \left[i \int d^4 x i \bar{\psi} \not \partial \psi\right] \frac{\partial}{\partial z^\mu}\left[\bar{\psi}(z) \gamma^\mu \psi(z)\right] \mathcal{O}\left(x_1, \ldots, x_n\right) $$ Since this holds for all $\alpha(z)$, we must have $$ \partial_\mu\left\langle J^\mu(x) \mathcal{O}\left(x_1, \ldots, x_n\right)\right\rangle=0 . $$
Now here's the contradiction: in QED (for example) isn't the point of gauge invariance that we ought to transform fermions and photons together to retain the form of the action? But in the above I've reasoned that the path integral is invariant even when we just transform the fermion fields?
So is the point of gauge invariance simply that is is a symmetry of the action alone and not the whole path integral? In which case it's a purely classical concept and not interesting in QFT...