This is a methodology to handle the pricing of bonds and other contingent claims subject to default risk as well as interest rate risk, under the assumption that financial distress takes place immediately when the bankruptcy process becomes smaller than a given deterministic and possibly time-dependent threshold. The uncertainty is driven by a three-dimensional diffusion process whose components represent the short-term interest rate, the bankruptcy process and the asset underlying the derivative security. By operating a change of probability measure, the price is shown to be dependent on two factors: the price of its default-free counterpart and a suitable exit probability. In general, such a probability does not admit a closed form, so it is numerically computed through Monte Carlo methods corrected by means of sharp large deviation techniques. Numerical results and comparisons with existing literature are provided.