Single-shot error correction corrects data noise using only a single round of noisy measurements on the data qubits, removing the need for intensive measurement repetition. We introduce a general concept of confinement for quantum codes, which roughly stipulates qubit errors cannot grow without triggering more measurement syndromes. We prove confinement is sufficient for single-shot decoding of adversarial errors and linear confinement is sufficient for single-shot decoding of local stochastic errors. Further to this, we prove that all three-dimensional homological product codes exhibit confinement in their X components and are therefore single shot for adversarial phase-flip noise. For local stochastic phase-flip noise, we numerically explore these codes and again find evidence of single-shot protection. Our Monte Carlo simulations indicate sustainable thresholds of 3.08 (4 )% and 2.90 (2 )% for three-dimensional (3D) surface and toric codes, respectively, the highest observed single-shot thresholds to date. To demonstrate single-shot error correction beyond the class of topological codes, we also run simulations on a randomly constructed family of 3D homological product codes.