Brainteaser 1771: Lottery logic

From The Sunday Times, 25th August 1996 [link]

For his weekly flutter on the National Lottery my friend has to select six of the numbers between 1 and 49 inclusive. Last week he wrote his numbers in numerical order and noticed something which he thought would interest me.

The first three numbers written in succession, with no gaps, formed a perfect square. The remaining three, similarly combined, formed another square. He suggested I try to deduce his six numbers.

Fortunately I knew his largest number was even and that he always chose one single-digit number.

Which numbers had he selected?

This puzzle was included in the book Brainteasers (2002, edited by Victor Bryant). The puzzle text above is taken from the book.