The force of attraction between $m_1$ and $m_2$ is given by
$$F = G\frac{m_1m_2}{r^2},$$ and so the acceleration of $m_1$ with respect to $m_2$ is given by
$$a = a_1 + a_2 = G\frac{m_1 + m_2}{r^2}.$$
Thus our problem becomes to solve the initial value problem
$$\frac{d^2r}{dt^2} = G\frac{m_1 + m_2}{r^2}, \frac{dr}{dt}(t = 0) = v_1(t = 0) + v_2(t = 0), r(t = 0) = d.$$
So if you can solve this IVP, you're done. The solution doesn't look pretty based on what WolframAlpha said...