The problem of calculating real-time correlation functions is formulated in terms of an imaginary-time partial differential equation. The latter is solved analytically for the perturbed harmonic oscillator and compared with the known exact result. The first order approximation for the short-time propagator is derived and used for numerical solution of the equation by a Monte Carlo integration. In general, the method provides a reformulation of the dynamic sign problem, and is applicable to any two-time correlation function including single-particle, density-density, current-current, spin-spin, and others. The prospects of extending the technique onto multi-dimensional problems are discussed.