Programming the hardware timers - advanced level

I've noticed that before, that the place you change OCR0A can affect results. I can't see any real explanation in the datasheet, except for page 108 where it says under CTC mode "Update of OCRx at ... Immediate".

But in your non-working sequence it isn't yet in CTC mode (you update OCR0A and then change to CTC mode) so somehow it loses that update.