We study the gap processes in a degenerate system of three particles interacting through their ranks. We obtain the Laplace transform of the invariant measure of these gaps, and an explicit expression for the corresponding invariant density. To derive these results, we start from the basic adjoint relationship characterizing the invariant measure, and apply a combination of two approaches: first, the invariance methodology of W. Tutte, thanks to which we compute the Laplace transform in closed form; second, a recursive compensation approach which leads to the density of the invariant measure as an infinite convolution of exponential functions. As in the case of Brownian motion with reflection or killing at the endpoints of an interval, certain Jacobi theta functions play a crucial role in our computations.