We consider an instability of rapidly rotating neutron stars in low-mass X-ray binaries with respect to excitation of r-modes. We argue that finite temperature effects in the superfluid core of a neutron star lead to a resonance coupling and enhanced damping (and hence stability) of oscillation modes at certain stellar temperatures. We demonstrate that neutron stars with high spin frequency spend substantial amount of time at these `resonance' temperatures. This finding allows us to explain puzzling observations of hot rapidly rotating neutron stars in low-mass X-ray binaries. It also imposes a new theoretical limit on the neutron star spin frequency, explaining the cut-off spin frequency ~730 Hz, following from the statistical analysis of accreting millisecond X-ray pulsars. Besides explaining the observations, our model provides a new tool to constrain superdense matter properties comparing measured and theoretically predicted resonance temperatures. This work was partially supported by RF president programme (grants MK-506.2014.2), by RFBR (grants 11-02-00253-a and 14-02-31616-mol-a), by the Dynasty Foundation, and by the Ministry of Education and Science of Russian Federation (Agreement No.\ 8409, 2012).