Solution 1:

Yes, this is true. As in your example, you need to start with integers $x,y$ such that the last term of the LHS of (5) is $dx^2+v_2xy+cwy^2=\pm1$. Make a change of variables to eliminate the $xy$ term (i.e., "complete the square"), which yields an equation of the form $p^2-Dq^2=1$. When $D$ is a positive nonsquare, this says that the element $p+q\sqrt{D}$ of $\mathbb{Z}[\sqrt{D}]$ has norm $1$. But it's classical to write down all elements of norm $1$: they are $\pm u^n$ where $n\in\mathbb{Z}$ and $u$ is the smallest element of $\mathbb{Z}[\sqrt{D}]$ such that $N(u)=1$ and $u>1$. Say $$ p+q\sqrt{D} = u^n $$ (the case of $-u^n$ works exactly the same way). Then $p-q\sqrt{D} = 1/u^n$, so $$ p=\frac{u^n+u^{-n}}2 \quad\text{ and }\quad q=\frac{u^n-u^{-n}}{2\sqrt{D}}. $$ Let's just consider nonnegative values of $n$, and write $p_n$ and $q_n$ for the above expressions. Then the corresponding values of $x$ and $y$ (call them $x_n$ and $y_n$) are linear combinations of $p_n$ and $q_n$, and hence of $u^n$ and $u^{-n}$. Writing, for instance, $a_n=ax_n^2−v_1x_ny_n+bwy_n^2$ for the value of the first number you're cubing, it follows that $a_n$ is a linear combination of $u^{2n}$, $1$, and $u^{-2n}$. Therefore $$ \sum_{n=0}^\infty a_n x^n $$ is a linear combination of $$ \sum_{n=0}^\infty u^{2n} x^n,\quad \sum_{n=0}^\infty x^n, \quad\text{and}\quad\sum_{n=0}^\infty u^{-2n} x^n, $$ or equivalently of $$ \frac{1}{1-u^2 x},\quad \frac{1}{1-x},\quad\text{and}\quad\frac{1}{1-u^{-2}x}. $$ Thus the generating function for $a_n$ is a rational function, and we could do the same for $b_n$ and $c_n$, in order to get a result similar to Ramanujan's.