We study cohomological gauge theories on total spaces of holomorphic line bundles over complex manifolds and obtain their reduction to the base manifold by U(1)-equivariant localization of the path integral. We exemplify this general mechanism by proving via exact path integral localization a reduction for local curves conjectured in hep-th/0411280, relevant to the calculation of black hole entropy/Gromov-Witten invariants. Agreement with the four-dimensional gauge theory is recovered by taking into account in the latter non-trivial contributions coming from one-loop fluctuation determinants at the boundary of the total space. We also study a class of abelian gauge theories on Calabi-Yau local surfaces, describing the quantum foam for the A-model, relevant to the calculation of Donaldson-Thomas invariants.