When approaching the atomically thin limit, defects and disorder play an increasingly important role in the properties of two-dimensional (2D) materials. While defects are generally thought to negatively affect superconductivity in 2D materials, here we demonstrate the contrary in the case of oxygenation of ultrathin tantalum disulfide (TaS2). Our first-principles calculations show that incorporation of oxygen into the TaS2 crystal lattice is energetically favourable and effectively heals sulfur vacancies typically present in these crystals, thus restoring the electronic band structure and the carrier density to the intrinsic characteristics of TaS2. Strikingly, this leads to a strong enhancement of the electron-phonon coupling, by up to 80% in the highly-oxygenated limit. Using transport measurements on fresh and aged (oxygenated) few-layer TaS2, we found a marked increase of the superconducting critical temperature (Tc) upon aging, in agreement with our theory, while concurrent electron microscopy and electron-energy loss spectroscopy confirmed the presence of sulfur vacancies in freshly prepared TaS2 and incorporation of oxygen into the crystal lattice with time. Our work thus reveals the mechanism by which certain atomic-scale defects can be beneficial to superconductivity and opens a new route to engineer Tc in ultrathin materials.