We present a convolution-based algorithm for finding cosmic rays in single well-sampled astronomical images. The spatial filter used is the point spread function (approximated by a Gaussian) minus a scaled delta function, and cosmic rays are identified by thresholding the filtered image. This filter searches for features with significant power at spatial frequencies too high for legitimate objects. Noise properties of the filtered image are readily calculated, which allows us to compute the probability of rejecting a pixel not contaminated by a cosmic ray (the false alarm probability). We demonstrate that the false alarm probability for a pixel containing object flux will never exceed the corresponding probability for a blank sky pixel, provided we choose the convolution kernel appropriately. This allows confident rejection of cosmic rays superposed on real objects. Identification of multiple-pixel cosmic ray hits can be enhanced by running the algorithm iteratively, replacing flagged pixels with the background level at each iteration.