This paper aims to investigate the localized corrosion mechanism of Q125 casing steel in residual acid solution with Mannich base type inhibitors during oil reservoir acidizing process. The corrosion behavior of Q125 casing steel in fresh acid (20% HCl) and residual acid solution (pH 1.0 and pH 3.0 HCl) with and without 3-(4-chlorophenylimino)-1-(piperidine-1-ylmethyl) indolin-2-one (Mannich base type, Mb) inhibitor was studied by electrochemical test, weight loss, and surface analysis. The morphology and composition of corrosion products were analyzed by SEM/EDS and XPS; the local corrosion rate of casing steel with or without inhibitor was obtained by 3D profilometry. It was determined that the inhibitor had higher inhibition efficiency in fresh acid conditions than in residual acid conditions. Under the condition of residual acid, the decrease in inhibitor molecular coverage on the substrate surface promotes the occurrence of local corrosion. Pitting corrosion was detected in the residual acid solution containing Mannich base inhibitor, which may be related to the fact that FeCO3 hinders the adsorption of inhibitor molecules on the substrate surface.