One way to see $f$ has at most one zero: If $f'(a) = 0$ for any real $a,$ the power series of $f$ at $a$ looks like $ f(a) + c(z-a)^n(1 + O(z-a)),$ with $c\ne 0$ and $n>1.$ It follows that there is $t\in (0,\pi)$ such that $\text {Im}\, f(a+re^{it})<0$ for small $r>0,$ contradiction. So $f$ restricted to $\mathbb {R}$ is real with $f'$ nonzero on $\mathbb {R}.$ Hence $f$ is either strictly increasing or strictly decreasing on $\mathbb {R}.$ Therefore $f$ has at most one zero in $\mathbb {R},$ and hence in $\mathbb {C}.$
From Poisson integral theory, we can conclude more in this problem: the only solutions are of the form $f(z)=a+bz,$ where $a\in \mathbb R ,b>0.$ Proof sketch: Suppose $u$ is positive and harmonic in the open unit disc $D$ with $u\in C(\overline D \setminus \{1\})$ and $u = 0$ on $\partial D \setminus \{1\}.$ Then $u$ is the Poisson integral of a positive Borel measure on $\partial D,$ and because of the boundary hypothesis, that measure is a point mass at $1.$ That implies $u$ is a constant times the Poisson kernel itself (based at $1$). You can then transfer this result to the upper half plane via a standard conformal map. The Poisson kernel above will magically transform into the function $y$ (or a constant times it). So in our problem, $\text {Im}\,f(x+iy) = by$ for some $b>0,$ and the rest follows.