In this paper, we consider nonlinear dynamics of a control circuit called phase-locked loop and provide a rigorous mathematical analysis to establish conditions under which the lock-in, pull-in, and hold-in ranges, which correspond to different types of system stability, coincide (the Viterbi problem). The analytical results are compared with both computer simulation and estimates of the lock-in and pull-in ranges, known from engineering literature. The comparison shows that those lock-in and pull-in range estimates may lead to cycle slipping and the loss of synchronization, respectively.