Modeling ion correlations in inhomogeneous polymers and soft matters with spatially varying ionic strength or dielectric permittivity remains a great challenge. Here, we develop a new theory that systematically incorporates electrostatic fluctuations into the self-consistent field theory for polymers. The theory is applied to polyelectrolyte brushes to explain abnormal phenomena observed in recent experiments. We show that ion correlations induce a nonmonotonic change of the brush height: collapse followed by reexpansion. The scaling analysis elucidates the origin as the competition between the repulsive osmotic pressure due to translational entropy and the attraction induced by ion correlations. We also clarify the absence of causal relationship between the brush collapse-reexpansion and the inversion of the surface electrostatic potential. Furthermore, strong ion correlations can trigger microphase separation, either in the lateral direction as pinned micelles or in the normal direction as oscillatory layers. Our theoretical predictions are in good agreement with the experimental results reported in the literature.