  When approaching the atomically thin limit, defects and disorder play an
increasingly important role in the properties of two-dimensional materials.
Superconductivity is generally thought to be vulnerable to these effects, but
here we demonstrate the contrary in the case of oxygenation of ultrathin
tantalum disulfide (TaS$_2$). Our first-principles calculations show that
incorporation of oxygen into the TaS$_2$ crystal lattice is energetically
favourable and effectively heals sulfur vacancies typically present in these
crystals, thus restoring the carrier density to the intrinsic value of TaS$_2$.
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 TaS$_2$, we found a marked increase of
the superconducting critical temperature ($T_{\mathrm{c}}$) 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 TaS$_2$ 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 $T_{\mathrm{c}}$ in ultrathin materials.
