Abstract We present a computational alternative to probabilistic simulations for non-smooth stochastic dynamical systems that are prevalent in engineering mechanics. As examples, we target (1) stochastic elasto-plastic problems, which involve transitions between elastic and plastic states, and (2) obstacle problems with noise, which involve discrete impulses due to collisions with an obstacle. We formally introduce a class of partial differential equations related to the Feynman–Kac formula, where the underlying stochastic processes satisfy variational inequalities modeling elasto-plastic and obstacle oscillators. We then focus on solving them numerically The main challenge in solving these equations is the non-standard boundary conditions which describe the behavior of the underlying process on the boundary. We illustrate how to use our approach to compute expectations and other statistical quantities, such as the asymptotic growth rate of variance in asymptotic formulae for threshold crossing probabilities.