Showing that $\int_{-\infty}^{\infty} \frac{\sinh ax}{\sinh \pi x} \, \cos bx \, dx = \frac{\sin a}{\cos a + \cosh b}$
I indeed integrated the wrong function.
Integrating $ \displaystyle f(z) = \frac{e^{(a+ib)z}}{\sinh \pi z}$ around the same contour, we get
$$ \begin{align} \text{PV} \int_{-\infty}^{\infty} f(x) \, dx + e^{-b}e^{ia} \ \text{PV}\int_{-\infty}^{\infty} f(x) \ dx &= \pi i \, \text{Res}[f(z),0] + \pi i \ \text{Res}[f(z),i]\\ &= i \, \left(1-e^{-b}e^{ia} \right) . \end{align} $$
Therefore,
$$ \text{PV} \int_{-\infty}^{\infty} f(x) \ dx = i \, \frac{1-e^{-b} e^{ia}}{1+e^{-b}e^{ia}} = \frac{\sin a}{\cos a + \cosh b} + i \, \frac{\sinh b}{\cos a + \cosh b} .$$
But notice that $$ \begin{align} \text{PV} \int_{-\infty}^{\infty} f(x) \, dx &= \text{PV} \int_{-\infty}^{\infty} \frac{\cosh ax}{\sinh \pi x} \, \cos bx \, dx + i \int_{-\infty}^{\infty} \frac{\cosh ax}{\sinh \pi x} \, \sin bx \, dx + \int_{-\infty}^{\infty} \frac{\sinh ax}{\sinh \pi x} \, \cos bx \, dx \\ &+ i \int_{-\infty}^{\infty} \frac{\sinh ax}{ \sinh \pi x} \, \sin bx \, dx \\ &= 0 + i \int_{-\infty}^{\infty} \frac{\cosh ax}{\sinh \pi x} \, \sin bx \, dx + \int_{-\infty}^{\infty} \frac{\sinh ax}{\sinh \pi x} \, \cos bx \, dx + 0 \\ &= \int_{-\infty}^{\infty} \frac{\sinh ax}{\sinh \pi x} \, \cos bx \, dx + i \int_{-\infty}^{\infty} \frac{\cosh ax}{\sinh \pi x} \, \sin bx \, dx . \end{align}$$
Equating the real parts on both sides of the equation, we get $$ \int_{-\infty}^{\infty} \frac{\sinh ax}{\sinh \pi x} \,\cos bx \, dx= \frac{\sin a}{\cos a + \cosh b}.$$
And equating the imaginary parts on both sides of the equation, we get $$ \int_{-\infty}^{\infty} \frac{\cosh ax}{\sinh \pi x} \, \sin bx \, dx = \frac{\sinh b}{\cos a + \cosh b}.$$
I have a simple way to calculate your old question. Note $$ \frac{\sinh(ax)}{\sinh(\pi x)} \cos(bx) = \frac{\sinh(ax)}{\sinh(\pi x)}\cosh(ibx)=\frac{\sinh((a+bi)x)+\sinh((a-bi)x)}{\sinh(\pi x)} $$ and $$ \int_0^\infty\frac{\sinh(ax)}{\sinh(bx)}dx=\frac{\pi}{2b}\tan\frac{a\pi}{2b}. $$ So \begin{eqnarray} I&=&\int_0^\infty\frac{\sinh(ax)}{\sinh(\pi x)} \cos(bx)dx\\ &=&\int_0^\infty\frac{\sinh((a+bi)x)+\sin((a-bi)x)}{\sinh(\pi x)}dx\\ &=&\frac{1}{2}\tan\frac{a+bi}{2}+\frac{1}{2}\tan\frac{a-bi}{2}\\ &=&\frac{\sin a}{\cos a + \cosh b}. \end{eqnarray}