There is a closed-form formula for the probability $\mathbb{P}(\tau = t_i)$.
First, we remind that
$$S_t=S_0\cdot \exp\left(\left(\mu-\frac{1}{2}\sigma^2 \right)t+\sigma W_t \right)
$$
For $i=1$, it's easy that
$$
\begin{align}
\mathbb{P}(\tau = t_1) &= \mathbb{P}(S_{t_1}> K ) \\
&=\mathbb{P}\left(W_{t_1}> \frac{\ln \left(\frac{K}{S_0}\right) -\left(\mu-\frac{1}{2}\sigma^2 \right)t_1}{\sigma} \right)\\
&=\color{red}{\Phi\left( \frac{-\ln \left(\frac{K}{S_0}\right) +\left(\mu-\frac{1}{2}\sigma^2 \right)t_1}{\sigma \sqrt{t_1}} \right)}
\end{align}
$$
where $\Phi(\cdot)$ the probability distribution function of the univariate standard normal distribution $\mathcal{N} (0,1) $.
For $i \ge 2$, we have
$$
\begin{align}
\mathbb{P}(\tau = t_i) &= \mathbb{P}(\bigcap_{0 \leq k \leq i-1} \{S_{t_k}\le K \} \cap \{S_{t_i}> K \} ) \\
&= \mathbb{P}\left(\bigcap_{0 \leq k \leq i-1} \left\{W_{t_k} \le \frac{\ln \left(\frac{K}{S_0}\right) -\left(\mu-\frac{1}{2}\sigma^2 \right)t_k}{\sigma} \right\} \cap \left\{W_{t_i}> \frac{\ln \left(\frac{K}{S_0}\right) -\left(\mu-\frac{1}{2}\sigma^2 \right)t_i}{\sigma} \right\} \right) \tag{1}\\
\end{align}
$$
We notice that the vector $(W_{t_1}, W_{t_2},...,W_{t_i})$ is a $i$-variate normal distribution with zero mean and the covariance matrix $\mathbf{\Sigma} \in \mathbb{R}^{i\times i}$ defined by
$$
\Sigma_{hk} = Cov (W_{t_h},W_{t_k}) = \min \{t_h,t_k\} \qquad \text{for }1\le h,k\le i \tag{2}
$$
By denoting $\Phi_i(\mathbf{L},\mathbf{U};\mathbf{0}_i,\mathbf{\Sigma} )$ the probability distribution function of the $i$-variate normal distribution $\mathcal{N}_i (\mathbf{0}_i,\mathbf{\Sigma}) $ with
- zero mean $\mathbf{0}_i$,
- covariance matrix $\mathbf{\Sigma}$ defined by $(2)$
- from the lower bound $\mathbf{L}$ to the upper bound $\mathbf{U}$ with $\mathbf{L}, \mathbf{U} \in \mathbb{R}^{i}$
$$L_k=\begin{cases}
-\infty & \text{if $0\le k\le i-1$ }\\
\frac{\ln \left(\frac{K}{S_0}\right) -\left(\mu-\frac{1}{2}\sigma^2 \right)t_k}{\sigma} & \text{if $k = i$ }\\
\end{cases}
$$
$$U_k=\begin{cases}
\frac{\ln \left(\frac{K}{S_0}\right) -\left(\mu-\frac{1}{2}\sigma^2 \right)t_k}{\sigma} & \text{if $0\le k\le i-1$ }\\
+\infty & \text{if $k = i$ }\\
\end{cases}
$$
Then, from $(1)$, we have
$$\mathbb{P}(\tau = t_i) = \color{red}{\Phi_i(\mathbf{L},\mathbf{U};\mathbf{0}_i,\mathbf{\Sigma} ) }$$
S_{t_i}
is the recognisable format. So your formula renders as $p(\tau > t_i) = 1 - 2p(S_{t_i}>K)$ $\endgroup$