Markie is right,
HO will always get to know your old ref number by using your surname and date of birth, this I believe is the first step taken before entering your information into the database.
In my case, i got exactly thesame ref number as my first application.