"nine winks'' seems to have appeared just before "forty winks";
the earliest example I found for "nine winks" was 1823 in John Badcock's,
'Slang: A Dictionary of the Turf, the Ring, the Chase, the Pit, or Bon-ton....';
the earliest example for 'forty winks' found was 1828 in Pierce Egan's,
'The Finish to the Adventures of Tom, Jerry, and Logic,'
From: A Tale of the Winds and the Waves
A Mournful Chant of Merrie Christmas,
Author Unknown, 1849