We report on multi-band observations of the transient source Swift J0840.7-3516, which was detected in outburst in 2020 February by the Neil Gehrels Swift Observatory. The outburst episode lasted just ~5 days, during which the X-ray luminosity quickly decreased from ~3E37 erg/s at peak down to ~5E33 erg/s in quiescence (0.3-10 keV; at 10 kpc). Such a marked and rapid decrease in the flux was also registered at UV and optical wavelengths. In outburst, the source showed considerable aperiodic variability in the X-rays on timescales as short as a few seconds. The spectrum of the source in the energy range 0.3-20 keV was well described by a thermal, blackbody-like, component plus a non-thermal, power law-like, component and it softened considerably as the source returned to quiescence. The spectrum of the optical counterpart in quiescence showed broad emission features associated mainly with ionised carbon and oxygen, superposed on a blue continuum. No evidence for bright continuum radio emission was found in quiescence. We discuss possible scenarios for the nature of this source, and show that the observed phenomenology points to a transient ultra-compact X-ray binary system.