Is Ito's lemma also valid with stopped integrals?

If (as is customary) the stochastic integral is understood to be continuous in $t$ (a.s.) then the equality holds for all $t$ simultaneously, with probability 1. As such, $t$ can be replaced throughout by any non-negative random variable and the a.s. equality will persist.


Under the same conditions under which the Itô formula is valid. Indeed, the process $X_s = W_{\tau \wedge s}$ is an Itô process with stochastic differential $dX_s = \mathbf{1}_{[0,\tau]}(s) dW_s$ (see e.g. our book with Yuliya Mishura, Theorem 8.4). Then, using the Itô formula and this "locality" property once more, $$ h(X_t) = h(X_0) + \int_0^t \nabla h(X_s)\mathbf{1}_{[0,\tau]}(s) dW_s + \frac{1}{2} \int_0^t \Delta h(X_s) \mathbf{1}_{[0,\tau]}(s)^2 ds \\ = h(W_0) + \int_0^{t \wedge \tau} \nabla h(W_s) dW_s + \frac{1}{2} \int_0^{t \wedge \tau} \Delta h(W_s) ds. $$