Let $R$ be a principal ideal domain, $p \in R$ be a prime element. Assume that $x^2+1 \equiv 0 \bmod p$ has a solution $i \in R$. Does it follow that there is some $u \in R$ such that $v_p(u^2+1)=1$? Here $v_p$ denotes the $p$-adic valuation. Equivalently, $u^2+1 \equiv p \cdot v \bmod p^2$ for some $p \nmid v$.
If $2$ is a unit in $R/p$, hence in $R/p^2$, then this is correct: Hensels Lemma gives a solution $i$ of $x^2+1 \equiv 0 \bmod p^2$. Then let $u=i(1-p/2)$ in $R/p^2$. Then $u^2+1=p$ holds in $R/p^2$.
If $p=2$, then we may take $u=1$.
This covers all cases for $R=\mathbb{Z}$.
You can give a very easy condition:
You have already covered the case, where $2 \notin (p)$: If $i$ is a solution, then $i(1-\frac{p}{2})$ is a solution $\neq 0 \mod{p^2}$. We dont need Hensel's Lemma there, because you assume the existence of $i$ anyway.
Here is the case $2 \in (p) \setminus (p^2)$: $2=1^2+1$ does the trick then.
Here is the case $2 \in (p^2)$: As I said in the comments, $x^2+1 \in (p)$ implies $(x+1)^2 \in (p^2)$, but then we have $x^2+1=(x+1)^2-2x \in (p^2)$.
The counterexample in the other answer is thus easily verified without any computations because $2=(1+i)(1-i) \in (1+i)^2$.