Extracting signals at low single-photon count rates from large backgrounds is a challenge in many optical experiments and technologies. Here, we demonstrate a single-photon lock-in detection scheme based on continuous photon timestamping to improve the SNR by more than two orders of magnitude. Through time-resolving the signal modulation induced by periodic perturbations, 98% of dark counts are filtered out and the <1 count=s contributions from several different nonlinear processes identified. As a proof-of-concept, coherent anti-Stokes Raman measurements are used to determine the vibrational lifetime of few molecules in a plasmonic nanocavity. This detection scheme can be applied to all single-photon counting experiments with any number of simultaneous modulation frequencies, greatly increasing SNRand resolving physical processes with picosecond time resolution while keeping the photon dosage small. The open instrumentation package provided here enables low-cost implementation.