Quantitative genetic analyses have been increasingly used to estimate the genetic basis of life-history traits in natural populations. Imperfect detection of individuals is inherent to studies that monitor populations in the wild, yet it is seldom accounted for by quantitative genetic studies, perhaps leading to flawed inference. To facilitate the inclusion of imperfect detection of individuals in such studies, we develop a method to estimate additive genetic variance and assess heritability for binary traits such as survival, using capture–recapture (CR) data. Our approach combines mixed-effects CR models with a threshold model to incorporate discrete data in a standard ‘animal model’ approach. We employ Markov chain Monte Carlo sampling in a Bayesian framework to estimate model parameters. We illustrate our approach using data from a wild population of blue tits (Cyanistes caeruleus) and present the first estimate of heritability of adult survival in the wild. In agreement with the prediction that selection should deplete additive genetic variance in fitness, we found that survival had low heritability. Because the detection process is incorporated, capture–recapture animal models (CRAM) provide unbiased quantitative genetics analyses of longitudinal data collected in the wild.