ULXs are the most luminous subclass of black hole X-ray binaries, often an order of magnitude more luminous than those known in our Galaxy. It is still hotly debated whether ULXs are powered by proportionally more massive black holes, or instead contain stellar-mass black holes accreting above their Eddington limit ("ultraluminous accretion state"). Thus, measuring black hole masses in ULXs would greatly enhance our understanding of black hole formation and of different regimes of accretion physics. Unfortunately, because of their distance, ULX optical counterparts are generally too faint to permit dynamical mass measurements. However, we have found a ULX in NGC 7793 (distance of about 3.7 Mpc) with a well-resolved B9I supergiant donor star. At V ~ 20.5 mag, it is bright enough for photometric and spectroscopic studies. We discovered a 65.2-day orbital period with a 0.5 mag amplitude in the V-band lightcurve, due to X-ray heating of the donor star. From the amplitude of the Balmer and He II 4686 radial velocity variations, and from our modelling of the optical lightcurve, we constrain the mass of the black hole to be less than about 15 solar masses. Therefore, our result suggests that the ultraluminous X-ray state is associated to supercritical accretion. Finally, we will discuss other intriguing properties of this source, still under investigation, such as an eclipsing precessing disk and a possible Doppler-shifted line from a relativistic jet.