An application of the strong Markov property in the proof of the connection between Brownian motion and harmonic functions Let $U$ be an open, connected set in $\mathbb{R}^n$ and let $(B(t))_{t \geq 0}$ be an $n$-dimensional Brownian motion with start at $x \in U$ and let $\overline{B_x(\delta)}$ be the closed ball about $x$ of radius $\delta$ that is contained in $U$. In order to get from $x$ to the boundary $\partial U$, $B(t)$ must first pass through $\partial B_x(\delta)$. I'd like to know how this can be proved rigorously. This is the gist of the problem.
More exactly, following is a theorem from chapter 3, "Harmonic functions, transience and recurrence" of Mörters and Peres's textbook Brownian Motion (to be referred to below as [M]). The theorem is listed below together with the proof given in the textbook (but not verbatim). I'm interested in a rigorous justification for the last couple of equations in the end of the proof, namely
$$
\begin{aligned}
E_x\left[E_x\left[\varphi(B(\tau))\mathbb{1}_{\{\tau < \infty\}} \mid \mathcal{F}^+(\rho)\right]\right] & = E_x\left[u(B(\rho))\right] \\
& = \int_{\partial B_x(\delta)} u(y) \mu_{x,\delta}(dy)
\end{aligned}
$$

Setting the stage
Let $n \in \mathbb{N}_1$. Denote by $\mathbf{C}$ the set consisting of
   all continuous functions from $[0,\infty)$ to $\mathbb{R}^n$. For
   every $t \in [0,\infty)$, denote by $\pi_t : \mathbf{C} \rightarrow
 \mathbb{R}^n$ the projection on the $t$th coordinate and denote by
   $\mathcal{B}$ the minimal $\sigma$-algebra on $\mathbf{C}$ in which
   all the $\pi_t$'s are measurable. For every $x \in \mathbb{R}^n$
   denote by $P_x$ the probability measure over the measurable space
   $(\Omega := \mathbf{C}, \mathcal{F} := \mathcal{B})$ that renders the
   stochastic process $(\pi_t)_{t \geq 0}$ a Brownian motion with start
   at $x$. For every $x \in \mathbb{R}^n$ and every
   $\mathcal{B}/\textrm{Borel}$-measurable function $\varphi: \mathbf{C}
 \rightarrow \mathbb{R}$, denote by $E_x(\varphi)$ the expectation of
   $\varphi$ with respect to the probability space $(\Omega, \mathcal{F},
 P_x)$, provided this expectation exists (we allow the possibility that
   $E_x(\varphi) \in \{\pm \infty\}$).
The Theorem
([M] Theorem 3.8, p. 68)
Suppose $U$ is a non-empty, open, connected set in $\mathbb{R}^n$ and
   define $\tau$ to be the first hitting time of $U$'s boundary, i.e. $$
 \tau := \inf \{t \geq 0 \mid : B(t) \in \partial U\} $$
Let $\varphi: \partial U \rightarrow \mathbb{R}$ be measurable w.r.t.
   the $\sigma$-algebra induced on $\partial U$ by
   $\textrm{Borel}(\mathbb{R}^n)$, and suppose the function $u: U
 \rightarrow \mathbb{R}$, defined by $$ u(x) := E_x[\varphi(B(\tau))
 \mathbb{1}_{\{\tau < \infty\}}] $$ for every $x \in U$, is locally
   bounded, i.e. for every $x \in U$ there is some neighborhood $N$ of
   $x$ such that $N \subseteq U$ and $u$ is bounded on $N$. In
   particular, we suppose that the expectation on the right is
   well-defined for every $x \in \mathbb{R}^n$.
Then $u$ is a harmonic function.
Proof
([M] Proof of theorem 3.8, p. 68)
We start with a lemma. 

Lemma ([M] Theorem 3.2, p. 65) Let $D \subseteq \mathbb{R}^n$ be a non-empty, open and connected set and let $v : D \rightarrow
 \mathbb{R}$ be a locally bounded function. Then $v$ is harmonic on $D$
     iff $v$ has the (spherical) mean value property: For all $z \in D$ and
     $s \in (0,\infty)$ such that the closed ball $\overline{B_z(s)}
 \subseteq D$, we have: $v$ is integrable on $\partial B_z(s)$ and $$
 v(z) = \int_{\partial B_z(s)} v(w) \mu_{z, s}(dw) $$ where $\mu_{z,
 s}$ is the normalized uniform measure on the sphere $\partial B_z(s)$.

Let $x \in \mathbb{R}^n$ and let $\delta \in (0,\infty)$ be such that
   the closed ball $\overline{B_x(r)} := \{y \in \mathbb{R}^n \mid: |y -
 x| \leq r\}$ is contained in $U$. Define the stopping time $\rho :=
 \inf \{t \in (0,\infty) \mid: B(t) \neq B_x(\delta)\}$. Then the
   strong Markov property implies that
   $$ \begin{aligned} u(x) & =
  E_x\left[E_x\left[\varphi(B(\tau))\mathbb{1}_{\{\tau < \infty\}} \mid \mathcal{F}^+(\rho)\right]\right] \\
 & = E_x\left[u(B(\rho))\right] \\
 & = \int_{\partial B_x(\delta)} u(y) \mu_{x,\delta}(dy) \end{aligned}
 $$
   where $\mu_{x,\delta}$ is the normalized uniform measure on the sphere $\partial B_x(\delta)$. Therefore, by the lemma, $u$ is harmonic. Q.E.D.

 A: Taken for granted that $\rho \leq \tau$, let us see why the derivation you gave makes sense. Recall the equation chain:
$$ \begin{aligned} u(x) & \stackrel{A}{=}
  E_x\left[E_x\left[\varphi(B(\tau))\mathbb{1}_{\{\tau < \infty\}} \mid \mathcal{F}^+(\rho)\right]\right] \\
 & \stackrel{B}{=} E_x\left[u(B(\rho))\right] \\
 & \stackrel{C}{=} \int_{\partial B_x(\delta)} u(y) \mu_{x,\delta}(dy)  \, .\end{aligned}
 $$
$A$: this is the definition of $u$ and a property of conditional expectation.
$B$: this is the strong Markov property and the definition of $u$, a bit more explicit:
I take some notation from the book of Revuz and Yor (Sections I.3 and III.3).
Define for $x \in E^{\mathbb{R}_+}$ and $ t\geq 0$ the translation operator $\theta_t: \, E^{\mathbb{R}_+} \to E^{\mathbb{R}_+}, \, x \mapsto \theta_t(x)$ with $(\theta_t(x))(s)= x(t+s)$. Define $\tau \circ \theta_t = \inf \{ s \geq 0 : \, B(s+t) \in \partial U\}$ and set $\theta_T(\omega) = \theta_t(\omega)$ if $T(\omega) = t$ for a stopping time $T$.
For the stopping times $\rho$ and $\tau$ it is true that
$$ \tau = \rho + \tau \circ \theta_\rho \, , $$
since $\rho \leq \tau$.
\begin{align} E_x\left[\varphi(B(\tau))\mathbb{1}_{\{\tau < \infty\}} \mid \mathcal{F}^+(\rho)\right] & = E_x\left[\varphi(B(\rho + \tau \circ \theta_\rho))\mathbb{1}_{\{\rho + \tau \circ \theta_\rho < \infty\}} \mid \mathcal{F}^+(\rho)\right] \\
& = E_{B(\rho)} \left[ \varphi(B(\tau)) \mathbb{1}(\tau < \infty) \right] \\
& = u(B(\rho)) \, .
\end{align}
$C$: The distribution of Browian motion started at $x \in \mathbb{R}^d$ hitting the sphere $\partial B_x(\delta) = \{y \in \mathbb{R}^d: \, |y| = 1\}$ is uniform: $P_x(B(\rho) \in dy) = \mu_{x,\delta}(dy)$.
Regarding $\rho \leq \tau$ (if $\rho = \inf \{ t\geq 0: \, B(t) \in \partial B_x(\delta)\}$): We take a single path $X \in \mathbf{C}$ with $X(0)=x \in \mathbb{R}^d$ and show $\rho \leq \tau$ pathwise. If $\tau = \infty$, there is nothing to show. So we can assume that $X(t) \in \partial U$ for some $\tau = t>0$.
Let $t' = \sup \{ s\geq 0:\, X(s) \in |x-X(s)|<\delta \}$ and $t'' = \inf \{s\geq t':\, |x-X(s)|>\delta\}$. Clearly, $t'\leq t''$. Since the modulus is continuous we know that $s \mapsto d(s) = |x-X(s)|$ is continuous. We have $d(t')\leq \delta$ since there is a sequence $s_n \to t'$ non-decreasing with $d(s_n)<\delta$. Similarly $d(t'')\geq \delta$. If $t'=t''$ we are done, otherwise note that for $r \in (t',t'')$ we can neither have $d(r)<\delta$, nor $d(r)>\delta$, also leading to $d(r) = \delta$. In both cases we conclude that there is a $r = \rho\leq t$ with $X(r) \in \partial B_x(\delta)$. But this says that for this particular path $\rho \leq \tau$.
A: Given a ball $\bar B_r(x)\subset D$,  consider the stopping time: 
$$\tau = \min\{t\geq 0;~ x+B_t\not\in B_r(x)\}$$ 
and also for each $z\in D$ let $\tau_z = \min\{t\geq 0;~ z+B_t\not\in
D\}$. We introduce two random variables $X_1$ and $X_2$ on the
probability space $(\Omega,\mathcal{F}, \mathbb{P})$ on which the
standard Brownian motion $\{B_t\}_{t\geq 0}$ is defined. The first
random variable is simply: $X_1=x+B_{\tau}$, taking values in the
measurable space $(D, \mathcal{F}_1)$ with the usual $\sigma$-algebra
$\mathcal{F}_1$ of Borel subsets of $D$.  
The second random variable $X_2$ is given by the paths of $B_{\tau+t} -
B_\tau$, almost surely belonging to $E_0=C[0,\infty),
\mathbb{R}^n)$. We make $E_0$ a measurable space by equipping it with
the $\sigma$-algebra $\mathcal{B}(E_0)$ of its Borel subsets with
respect to the topology of uniform convergence on compact
intervals. In fact, $X_2$ takes values in a measurable subset $E$ of
$E_0$, consisting of these $f\in E$ which satisfy:
$f(0)=0$ and $|f(T)|>\mbox{diam} \, D$ for some $T>0$. We name
$\mathcal{F}_2$ the $\sigma$-algebra $\mathcal{B}(E_0)$ restricted to $E$. 
Checking the measurability property of $E$ in $E_0$, as well as
measurability of $X_2$ with respect to $(E,\mathcal{F}_2)$ relies on
observing that $\mathcal{B}(E_0)$ is generated by the countable family
of sets of the type $A_{g,T,r} = \{f\in E_0;~
\|f-g\|_{L^\infty[0,T]}\leq r\}$, where $g$ are polynomials with
rational coefficients, and $T,r>0$ are rationals. 
Now, the crucial observation is that $X_1$ and $X_2$ are
independent. Indeed, $X_1$ is clearly $\mathcal{F}_\tau$-measurable,
whereas $X_2$ is $\mathcal{F}_\tau$-independent. This last statement
is a direct consequence of the strong Markov property for the shifted
Brownian motion $\{B_{\tau+t} - B_\tau\}_{t\geq 0}$ and can be checked
directly on the preimages of sets $A_{g,T,r}$. 
We call $\mu_1$ the push-forward measure of $\mathbb{P}$ via $X_1$
and $\mu_2$ the push-forward of $\mathbb{P}$ via $X_2$.
Thus $(D,\mathcal{F}_1,\mu_1)$ and $(E,\mathcal{F}_2,\mu_2)$ 
are two probability spaces, and the independence of $X_1$ and $X_2$
  is equivalent to the product $\mu_1\times
\mu_2$ equaling the push-forward of $\mathbb{P}$ on $D\times E$
via $(X_1, X_2)$. 
Finally, consider the following random variable on $D\times E$, valued in $\mathbb{R}$:
$$F(z,f) = \varphi\big(z+f(\min\{t\geq 0;~ z+f(t)\not\in D\})\big).$$
We write:
\begin{equation*}
\begin{split}
u(x) & = \mathbb{E}[\varphi(x+B_{\tau_x}] = \mathbb{E}[F\circ (X_1,
X_2)] = \int_{D\times E} F \;d(\mu_1\times\mu_2) \\ & = 
\int_D\int_E F(z,f)\;d\mu_2(f) \;d\mu_1(z)=\int_D \mathbb{E}[F(z,X_2)]\;d\mu_1(z),
\end{split}
\end{equation*}
where we simply used Fubini's theorem. In conclusion:
\begin{equation*}
\begin{split} 
u(x) & = \int_D \varphi(z+B_{\tau_z}) \;d\mu_1(z) = \int_D u(z)
\;d\mu_1(z) \\ & = \mathbb{E}[u\circ X_1] = \mathbb{E}[u(x+B_{\tau})], 
\end{split}
\end{equation*}
as claimed.
