Just to explain Eric's construction in more elementary terms (and to point out that you can get something stronger than in your question). Define $C$ as follows:
$$C_n=\left\{
\begin{array}{ll}
B_n,&n>0,\\
A_n&n<0.
\end{array}
\right.$$
Moreover, let $d_n\colon C_n\rightarrow C_{n-1}$ be the differential of $B$ (resp. $A$) if $n>1$ (resp. $n<0$). We must still define $C_0$ and its surrounding differentials.
We define $C_0$ as the push-out
$$\begin{array}{ccc}
Z_0(A)&\rightarrow&Z_0(B)\\
\downarrow&&\downarrow\\
A_0&\rightarrow&C_0
\end{array}$$
The upper arrow is the map induced on $0$-cycles by $f$ and the left arrow is the inclusion of $0$-cycles in $0$-chains, which is injective. Therefore the parallel arrow is also injective. Moreover, $A_0/Z_0(A)=C_0/Z_0(B)$.
The differential $d_0\colon C_0\rightarrow C_{-1}=A_{-1}$ is given by applying the universal property of a push-out to $d_0\colon A_0\rightarrow A_{-1}$ and the trivial map $0\colon Z_0(B)\rightarrow A_{-1}$. This shows that $Z_0(C)=Z_0(B)$ and that the images of $d_0\colon C_0\rightarrow C_{-1}=A_{-1}$ and $d_0\colon A_0\rightarrow A_{-1}$ coincide.
The differential $d_1\colon C_1=B_1\rightarrow C_0$ is the composite $B_1\rightarrow Z_0(B)\hookrightarrow C_0$.
We now take $h\colon A\rightarrow C$ to be $f_n\colon A_n\rightarrow B_n$ for $n>0$, the identity for $n<0$, and the bottom map in the push-out square for $n=0$. The map $g\colon C\rightarrow B$ is the identity for $n>0$, $f_n\colon A_n\rightarrow B_n$ for $n<0$, and for $n=0$, the map induced by applying the universal property of a push-out to $f_0\colon A_0\rightarrow B_0$ and $Z_0(B)\hookrightarrow B_0$.
Clearly $f=gh$. Moreover, $\tau_{\geq 0}g$ and $\tau_{\leq -1}h$ are identity maps, not only weak equivalences, by the previous computations. This construction is actually functorial in $f$.