This relates to David Tong's notes on electromagnetism, specifically page 18.
We have as our charge density a delta function:
$$\rho(\vec x)=Q\delta^{(3)}(\vec x).$$
We want to solve:
$$\nabla^2\phi=-\frac{Q}{\epsilon_0}\delta^{(3)}(\vec x) \tag{2.14}.$$
To do this we postulate that:
$$\phi=\frac{\alpha}{r},$$
solves $\nabla^2\phi=0$, and after some vector calculus and some algebra we find that it does. However, next we use Gauss' law (with $S$ a sphere centred on the delta function) and find that:
$$\int_S\nabla\phi\cdot d\vec S=Q/\epsilon_0,$$
which, after working through the calculation and inserting our equation for $\phi$ leads to:
$$\phi=\frac{Q}{4\pi r\epsilon_0} \tag{2.16}.$$
I see how we do this, but, if I apply the divergence theorem to the above integral, I find:
$$\int_V \nabla^2\phi \text{ }dV=0,$$
since, as already established, $\nabla^2\phi=0$? What is going on here?