We can show that
$$\int_{-\infty}^{\infty} dx \: e^{-i x^2} = \sqrt{\frac{\pi}{i}} = \sqrt{\pi} e^{-i \frac{\pi}{4}} $$
actually works rigorously...er, relatively speaking. A way to do this is to consider the integral
$$\oint_{C_R} dz \: e^{-z^2} $$
where $C_R$ consists of the interval $[0,R]$ along the $\Re{z}$ axis, a circular arc of radius $R$ centered at the origin, with endpoints at $(R,0)$ and $(R,R)/\sqrt{2}$, and the line segment from $(R,R)/\sqrt{2}$ to the origin. (That is, substitute $z = e^{i \pi/4} t$ into the integral.) Note that there are no poles inside of $C_R$, for any value of $R$. Then take the limit as $R \rightarrow \infty$ and note that the integral along the circular arc vanishes. Apply Cauchy's Integral Theorem, and the desired result is shown.
Note that this analysis applies to the Fourier transform of such a function as well, as all the transform piece does is shift the center of the quadratic in the exponential. The piece that is the transform is factored outside of the integral and doesn't change this analysis.
To be explicit, we can write
$$\begin{align} \oint_{C_R} dz \: e^{-z^2} &= 0 \\ &= \int_0^R dx \: e^{-x^2} + i R \int_0^{\pi/4} d \phi e^{i \phi} e^{-R^2 \exp{(i 2 \phi)}} + e^{i \pi/4} \int_R^0 dt \: e^{-i t^2} \end{align} $$
The 2nd integral vanishes as $R \rightarrow \infty$ because the exponential term in the exponent does not change sign within the integration region. We may then conclude that
$$\int_0^{\infty} dx \: e^{-x^2} = \sqrt{i} \int_0^{\infty} dt e^{-i t^2}$$
or
$$\int_{-\infty}^{\infty} dt \: e^{-i t^2} = \sqrt{\frac{1}{i}} \int_{-\infty}^{\infty} dx \: e^{-x^2} = \sqrt{\frac{\pi}{i}} $$
This applies to your first integral, which converges so long as $\Re{a} \ge 0$. You simply do as you state: evaluate
$$\frac{1}{2} \Im{\sqrt{\frac{\pi}{a+i b}}}$$
Your second integral is more interesting. There, it is a little less clear how to use a contour that transforms the problem into one where you know you have convergence. In this case, however, it turns out that a similar contour as described above, except that a wedge angle of $\pi/8$ and not $\pi/4$ does the trick. In that case, you get, as the integral,
$$e^{i \pi/8} \int_0^{\infty} dx \: \exp{\left [- e^{i \pi/4} \left ( a x^2 + \frac{|b|}{x^2} \right ) \right ]}$$
which, again, is OK so long as $\Re{a} \ge 0$ and $\Re{b}=0$.