"how could I possibly have bonked on a six mile ride when I'd had a latte and a cookie an hour before I started"
Sounds to me as though the latte and cookie could have caused you to crash. When you eat sugary foods it is usually a good idea to either start working out immediately thereafter or wait a couple of hours for the food to digest before heading out. Or eat foods naturally high in fructose that will give you a steady supply of energy without a "whiplash" effect.