I originally understood the problem as if the target is also falling, so I'm going to solve the problem in two different scenarios. The first is my original solution, when the target is also falling instead of moving at constant velocity. The second scenario is when the target has some means of propulsion that keeps its velocity constant.
I'm going to use a more intuitive and common notation to solve the problem. First, define a coordinate system whose origin is at the barrel's exit point.
Falling target
The equations of motion for the target and the munition (I'll call it a bullet from now on), in vector notation, are:
$$
\mathbf{r}_T(t) = \mathbf{r}_T(0) + \mathbf{v}_T(0)\,t + \frac{1}{2}\,\mathbf{g}\,t^2
$$
and
$$
\mathbf{r}_B(t) = \mathbf{v}_B\,t + \frac{1}{2}\,\mathbf{g}\,t^2
$$
where $\mathbf{r}_T(0)$ is the vector position of the target, with respect to the barrel's exit point, at the time of firing ($t=0$), $\mathbf{v}_T(0)$ is the velocity of the target at the time of firing, $\mathbf{v}_B$ is the initial velocity of the bullet, and $\mathbf{g}$ is the acceleration of gravity. Note that the vector position of the bullet at the time of firing is the origin, as expected.
The condition for the bullet to hit the target is simply that their position vectors are the same at some moment in time $t > 0$, that is,
$$
\mathbf{r}_B(t) = \mathbf{r}_T(t)
$$
Thus, you need to solve
$$
\mathbf{r}_T(0) + \mathbf{v}_T(0)\,t = \mathbf{v}_B\,t
$$
whose solution, since $t > 0$, is
$$
\mathbf{v}_B = \mathbf{v}_T(0) + \frac{\mathbf{r}_T(0)}{t}
\qquad(1)
$$
To find $t$, we now use the fact that $|\mathbf{v}_B|$ is known. Squaring (1), we find
$$
v_B^2 = v_T^2 + \frac{r_0^2}{t^2} + \frac{2\,\mathbf{v}_T(0)\cdot\mathbf{r}_T(0)}{t}
$$
where $\cdot$ represents the dot product of the two vectors involved, $v_T$ is a shorthand for $|\mathbf{v}_T(0)|$, and $r_0$ is a shorthand for $|\mathbf{r}_T(0)|$. This can be rewritten as
$$
(v_B^2 - v_T^2)\,t^2 - 2\,\mathbf{v}_T(0)\cdot\mathbf{r}_T(0)\,t - r_0^2 = 0
\qquad(2)
$$
This is a quadratic equation on $t$ and may have 0, 1, or 2 real solutions. You're looking for a positive real solution, since you want $t>0$, if a real solution exists at all. If there are 2 real solutions, both positive, then you want the smallest solution.
Once a positive solution to (2) is found, you can plug that result back into (1) and obtain the components of the bullet velocity. Note that the acceleration of gravity does not appear anywhere in the solution, and that's expected since gravity affects both the target and the bullet in identical ways.
You can tell how many real solutions there will be by examining the sign of the discriminant $\Delta$ of the quadratic equation:
$$
\frac{\Delta}{4} \equiv \left(\,\mathbf{v}_T(0)\cdot\mathbf{r}_T(0)\,\right)^2 + (v_B^2 - v_T^2)\,r_0^2
$$
If $\Delta < 0$ then there are no real solutions. If $\Delta = 0$, there is only one real solution, and if $\Delta > 0$ there are 2 real solutions. Assuming that $\Delta \ge 0$, the solution(s) is(are):
$$
t = \frac{2\,\mathbf{v}_T(0)\cdot\mathbf{r}_T(0) \pm \sqrt{\Delta}}{2\,(v_B^2 - v_T^2)} = \frac{\mathbf{v}_T(0)\cdot\mathbf{r}_T(0) \pm \sqrt{\frac{\Delta}{4}}}{(v_B^2 - v_T^2)}
$$
Target moving at constant velocity
The equations of motion for the target and the bullet, in vector notation, are:
$$
\mathbf{r}_T(t) = \mathbf{r}_T(0) + \mathbf{v}_T\,t
$$
and
$$
\mathbf{r}_B(t) = \mathbf{v}_B\,t + \frac{1}{2}\,\mathbf{g}\,t^2
$$
where $\mathbf{r}_T(0)$ is the vector position of the target, with respect to the barrel's exit point, at the time of firing ($t=0$), $\mathbf{v}_T$ is the (constant) velocity of the target, $\mathbf{v}_B$ is the initial velocity of the bullet, and $\mathbf{g}$ is the acceleration of gravity. Note that the vector position of the bullet at the time of firing is the origin, as expected.
The condition for the bullet to hit the target is simply that their position vectors are the same at some moment in time $t > 0$, that is,
$$
\mathbf{r}_B(t) = \mathbf{r}_T(t)
$$
Thus, you need to solve
$$
\mathbf{r}_T(0) + \mathbf{v}_T\,t = \mathbf{v}_B\,t + \frac{1}{2}\,\mathbf{g}\,t^2
$$
which we can write as
$$
\mathbf{v}_B\,t = \mathbf{r}_T(0) + \mathbf{v}_T\,t - \frac{1}{2}\,\mathbf{g}\,t^2
\qquad(1)
$$
To find $t$, we now use the fact that $|\mathbf{v}_B|$ is known. Squaring (1), we find
$$
v_B^2\,t^2 = r_0^2 + v_T^2\,t^2 + \frac{1}{4}\,g^2t^4 + 2\,\mathbf{r}_T(0)\cdot\mathbf{v}_T\,t
- \mathbf{r}_T(0)\cdot\mathbf{g}\,t^2 - \mathbf{v}_T\cdot\mathbf{g}\,t^3
$$
or, after simplifying,
$$
\frac{1}{4}\,g^2t^4 - \left(\mathbf{v}_T\cdot\mathbf{g}\right)t^3 + \left(v_T^2 - v_B^2 - \mathbf{r}_T(0)\cdot\mathbf{g} \right)t^2 + 2\left(\mathbf{r}_T(0)\cdot\mathbf{v}_T\right)t + r_0^2 = 0
$$
where $\cdot$ represents the dot product of the two vectors involved and $r_0$ is a shorthand for $|\mathbf{r}_T(0)|$.
This is a quartic equation for $t$ and, once again, you're looking for the smallest positive real solution, if a solution exists at all. Once such a solution is found, then plugging it into
$$
\mathbf{v}_B = \frac{\mathbf{r}_T(0)}{t} + \mathbf{v}_T - \frac{1}{2}\,\mathbf{g}\,t
$$
(which is obtained from (1) by dividing by $t$) will give the components of the bullet velocity.
A note about $\mathbf{r}_T(0)$
$\mathbf{r}_T(0)$ is the position of the target relative to the barrel's exit point, at the time of firing the weapon. If the size of the weapon can be ignored then this is simply the vector position of the target at the time of firing minus the vector position of the weapon (at the time of firing), relative to whatever coordinate system you have.
A note about the dot product:
The dot product of two vectors $\mathbf{a}$ and $\mathbf{b}$ is a real number (not a vector) given by
$$
\mathbf{a} \cdot \mathbf{b} = a_xb_x + a_yb_y + a_zb_z
$$