EDIT: there is an elementary trick to do this due to Aubry, it is Theorem 4 on page 5 of PETE.
The positive primitive binary forms which give the easy Aubry trick showing rational implies integral are: $$ x^2 + y^2, x^2 + 2 y^2, x^2 + 3 y^2, x^2 + 5 y^2, $$ $$ x^2 + x y + y^2, x^2 + x y + 2 y^2, x^2 + x y + 3 y^2, $$ $$ 2 x^2 + 3 y^2, 2 x^2 + x y +2 y^2, 2 x^2 + 2 x y + 3 y^2. $$ Note that these are all "ambiguous," that is, equivalent to their "opposites." This is not an accident.
Probably needs mention, for the property mentioned by the OP there is no difference between the sum of two squares and the sum of three squares...
Right, I don't know about Fermat, but this phenomenon happens often enough. The first mention on MO is http://mathoverflow.net/questions/3269/intuition-for-the-last-step-in-serres-proof-of-the-three-squares-theorem
and the technique, due to Aubry, Cassels, and Davenport, is mentioned in Serre A Course in Arithmetic, pages 45-47, and Weil Number Theory: An approach through history from Hammurapi to Legendre, pages 59 and 292ff in which Fermat's possible thinking is discussed.
About my use of the word "phenomenon," it is necessary for the Aubry-Cassels-Davenport trick to work that we have Pete's "Euclidean" condition, http://mathoverflow.net/questions/39510/must-a-ring-which-admits-a-euclidean-quadratic-form-be-euclidean which is usually, for positive quadratic forms, referred to as a bound on the "covering radius" of the integral lattice under consideration. It took me a year or so to prove that Pete's condition implied that there could only be one class in that genus, http://mathoverflow.net/questions/69444/a-priori-proof-that-covering-radius-strictly-less-than-sqrt-2-implies-class-nu
A complete list of positive forms that satisfy Pete's condition is at NEBE. A mild generalization of the condition, due to Richard Borcherds and his student, Daniel Allcock, applies to such forms as the sum of five squares.