The details of what I will say can be found in standard texts on the subject(See for example Peskin and Schroeder:Pg 284), but I will emphasize the main ideas, since some of the ideas may be obscured in calculations sometimes.
You are computing the transition amplitude:
$$Z[J]=\lim_{t,t' \to \mp \infty}\frac{\langle q't'|q,t \rangle_J}{\langle q't'|q,t \rangle}$$
Where it is easy to see that this expression is written out in the Heisenberg picture(Operator $Q_{H}(t)$ has time dependance which its Eigenstates($|q,t \rangle,|q',t' \rangle$ inherit).
Written in the Schrödinger picture:
$$Z[J]=\lim_{t,t' \to \mp \infty}\frac{\langle q'|e^{-i\int_{t}^{t'}dt''(H-QJ(t''))}|q \rangle}{\langle q'|e^{-iH(t-t')}|q \rangle}$$
From here on out, one uses the path integral ideas to convert this to a path integral of the form:
$$Z[J]=\lim_{t,t' \to \mp \infty}\frac{\int D[q] e^{i\int_{t}^{t'}dt''\frac{m}{2}\dot{q}^2-V(q)+qJ(t'')}}{\int D[q] e^{i\int_{t}^{t'}dt''\frac{m}{2}\dot{q}^2-V(q)}}$$
Its easy to see that both numerator and denominator are oscillating integrals whose convergence is not guaranteed. So the trick is to make the prescription: $m \to m+ i\epsilon, V \to V -i\epsilon V(q)$. This creates a damping factor for the path integral of the form: $exp^{-\epsilon \int_t^{t'}dt'' H(p,q)}$. Provided that the hamiltonian is bounded from below(existence of a stable vacuum),this is a positive damping factor. What is the effect of this prescription on the original partition function?
To see this, consider the original matrix element, now written out explicitly:
$$\langle q'|e^{-i\left(\frac{p^2}{2m+2i\epsilon}+V(q)(1-i\epsilon)\right)(t'-t)}|q \rangle$$
$$=\langle q'|e^{-i\left(\frac{p^2}{2m}(1-\frac{i\epsilon}{m})+V(q)(1-i\epsilon)\right)(t'-t)}|q \rangle=\langle q'|e^{-i\left(\frac{p^2}{2m}+V(q)\right)(1-i\epsilon)(t'-t)}|q \rangle$$
Now expand the position eigenstates in the basis of hamiltonian Eigenstates in a standard fashion:
$$|q\rangle=\sum_i c_i(q) |n_i\rangle$$
Where $|n_i\rangle$ anre the energy eigenstates.
Some algebra later, the matrix element turns out to be:
$$=\langle q'|e^{-i\left(\frac{p^2}{2m+2i\epsilon}+V(q)(1-i\epsilon)\right)(t'-t)}|q \rangle =\sum_i e^{-iE_i(1-i\epsilon)(t'-t)}c_i(q)c_i^*(q')$$
Pulling out an $E_0$:
$$=e^{-iE_0(1-i\epsilon)(t'-t)}\left(c_0(q)c_0^*(q')+\sum_{i\neq 0} e^{-i(E_i-E_0)(1-i\epsilon)(t'-t)}c_i(q)c_i^*(q')\right) $$
Similar algebra goes through for the numerator with the $J$'s.Now, in the $t',t\to \pm \infty$ all but the first term goes to zero. Further, the factors of $e^{-iE_0(1-i\epsilon)(t'-t)}\left(c_0(q)c_0^*(q')\right)$ cancel in the numerator and denominator and therefore only the vacuum to vacuum transition amplitude the presence of a source and the vacuum to vacuum transition amplitude in the absence of a source remain in the numerator and denominator respectively. Notice that all the information about the boundary conditions are in the $c_0(q)$,$c_0(q')$. But these cancel meaning that the boundary conditions applied don't really matter.
Hope this helps!
In field theory, the mass term appears with the opposite sign in the Lagrangian and therefore goes in the opposite direction as far as the sign in front of $\epsilon$ goes.