  Among the compact objects observed in gravitational wave merger events a few
have masses in the gap between the most massive neutron stars (NSs) and least
massive black holes (BHs) known. Their nature and the formation of their
merging binaries are not well understood. We report on pulsar timing
observations using the Karoo Array Telescope (MeerKAT) of PSR J0514-4002E, an
eccentric binary millisecond pulsar in the globular cluster NGC 1851 with a
total binary mass of $3.887 \pm 0.004$ solar masses. The companion to the
pulsar is a compact object and its mass (between $2.09$ and $2.71$ solar
masses, 95% confidence interval) is in the mass gap, so it either is a very
massive NS or a low-mass BH. We propose the companion was formed by a merger
between two earlier NSs.
