$\displaystyle \int e^{-\frac{1}{2}Az^2+Bz-\frac{1}{2}C}dz=e^{-\frac{1}{2}(C-\frac{B^2}{A})} \sqrt{\frac{2\pi}{A}}$.

You have to divide by $\displaystyle \sqrt{2\pi\sigma^2}$ to get $\displaystyle I$, thus $\displaystyle I=\frac{1}{\sqrt{1+\frac{\sigma^2}{\omega^2}}}e^{-\frac{1}{2}(C-\frac{B^2}{A})}$. All you have to do now is see that $\displaystyle C-\frac{B^2}{A}=\frac{(\mu-\theta)^2}{\sigma^2+\omega^2}$.

In order to make this last step easier, you can notice the following: if we let $\displaystyle a=\frac{1}{\sigma}$, $\displaystyle b=\frac{1}{\omega}$, $\displaystyle c=\frac{\mu}{\sigma}$, $\displaystyle d=\frac{\theta}{\omega}$, then $\displaystyle A=a^2+b^2$, $\displaystyle B=ac+bd$ and $\displaystyle C=c^2+d^2$, and we have the following beautiful identity (for any $\displaystyle a,b,c,d$):

$\displaystyle (a^2+b^2)(c^2+d^2)=(ac+bd)^2+(ad-bc)^2$,

so that $\displaystyle C-\frac{B^2}{A}=\frac{AC-B^2}{A}=\frac{(ad-bc)^2}{A}$ $\displaystyle =\frac{\left(\frac{\mu}{\sigma\omega}-\frac{\theta}{\sigma\omega}\right)^2}{\frac{1}{\si gma^2}+\frac{1}{\omega^2}}=\frac{(\mu-\sigma)^2}{\omega^2+\sigma^2}$. qed.

About the previous identity with a,b,c,d (dating back to Euler): it can be seen as an expression of the formula $\displaystyle |z|^2|z'|^2=|zz'|^2$ where $\displaystyle z=a+ib$, $\displaystyle z'=c+id$. Of course this identity is not absolutely necessary here, you can just expand and see many terms simplify. There is a reason why this identity is involved: the integral can be written $\displaystyle \int e^{-\frac{1}{2}|uz-v|^2}dz$ where $\displaystyle u=\frac{1}{\sigma}+i\frac{1}{\omega}$, $\displaystyle v=\frac{\mu}{\sigma}-i\frac{\theta}{\omega}$. But the justification of the computation is more delicate if we do it this way.

As a conclusion, $\displaystyle \int e^{-\frac{(x-\mu)^2}{2\sigma^2}}e^{-\frac{(x-\theta)^2}{2\omega^2}}\frac{dx}{\sqrt{2\pi\sigma^2 }}=\frac{1}{\sqrt{1+\frac{\sigma^2}{\omega^2}}}e^{-\frac{(\mu-\theta)^2}{2(\sigma^2+\omega^2)}}$.

(NB: there is a minus sign in front of the exponent of the answer; it wasn't in your post)

Feel free to ask for details if something's unclear.