I'll give an outline of the more functional analytic proof. You should still try the contour integration proof though, it is a good technique for the Stieltjes transform.
Write $z = a + bi$, then $\frac{1}{(t-a)-bi}=\frac{(t-a)+bi}{(t-a)^2+b^2}$. From this we can see that $g(\bar{z}) = \overline{g(z)}$ and therefore $g(z) - g(\bar{z}) = 2\iota\Im{g(z)}$. Define $g_\epsilon(x)=\frac{\epsilon}{x^2+\epsilon^2}$. Some elementary calculus shows that $\int_\mathbb{R} g_\epsilon dm=\pi$ for all $\epsilon>0$
Now observe that $\Im g(x+i\epsilon) = \int_{-\infty}^\infty \frac{\epsilon f(t)dt}{(t-x)^2+\epsilon^2} = g_\epsilon \ast f(x)$. Since $g_\epsilon$ has a nice antiderivative when you integrate it, it is easy to show that most of its mass is concentrated around $0$ and in fact as you take $\epsilon \to 0$ all of its mass is concentrated there. For the moment,take a continuous function with compact support (you want uniform continuity) and show that for $\epsilon$ chosen sufficiently small you can force $\frac{1}{\pi}f \ast g_\epsilon (x)-f(x)$ to be arbitrarily small. I forgot a factor of $2\iota$ above. Now you have to show that you aren't too far off by taking a compact support function. To do that I think you need to split up $f$ into two parts so that you can do an infinity norm approximation near $0$ and an $L^1$ approximation with Young's lemma near infinity.