Let $f$ be a binary quadratic form with co-prime integer coefficients and irreducible over $\mathbb{Q}$. Let $[f]_{\mathbb{Z}}$ denote the $\operatorname{SL}_2(\mathbb{Z})$-equivalence class of $f$, under the usual substitution action. It is well-known that $[f]_{\mathbb{Z}}$ represents an ideal class in the narrow class group of the quadratic order of discriminant equal to $\Delta(f)$, the discriminant of $f$.

Let $p$ be a prime represented by $f$ which does not divide $\Delta(f)$. It is well-known that $[f]_{\mathbb{Z}}$ contains a form $g$ of the form

$$\displaystyle g(x,y) = px^2 + mxy + ny^2.$$

Over $\mathbb{F}_p$, $g$ factors as $y(mx + ny)$. Let $L$ denote the lattice defined by the congruence condition $mx + ny \equiv 0 \pmod{p}$. Let $(u_1, v_1), (u_2, v_2)$ be a basis of $L$, and consider the quadratic form $h$ given by $h(x,y) = g(u_1 x + u_2 y, v_1 x + v_2 y)$. Then $h$ is identically zero modulo $p$, and indeed $p$ divides the content of $h$. We may thus write $h(x,y) = p \cdot (s_2 x^2 + s_1 xy + s_0 y^2)$. Observe that $s_1^2 - 4s_2 s_0 = \Delta(f)$.

My question is, what is the ideal class of the form $s(x,y) = s_2 x^2 + s_1 xy + s_0 y^2$? I suspect that the ideal class of $s$ must in fact be the square of the ideal class of $f$ in the ideal class group, but I can't come up with a convincing proof.

My next question is, suppose that we lift the lattice $L$ (corresponding to the linear divisor $mx + ny$ modulo $p$) via Hensel's lemma to mod $p^3$ (this is possible because the linear factor has multiplicity one, or equivalently, the root of the form $f(x,1)$ mod $p$ is simple). What is the ideal class of the corresponding quadratic form obtained after dividing by $p^3$, as in the above construction?

Addendum: I have verified the first conjecture for the following quadratic forms:

$\displaystyle f_1(x,y) = 5x^2 + 3xy + 7y^2, f_2(x,y) = 7x^2 + 3xy + 9y^2, f_3(x,y) = 11x^2 + 2xy + 15y^2$.

It is still a bit of a mystery what's happening with the second question.