UART communication issue on Arduino Mega
Serial.flush() only empties the output buffer, so that won't achieve anything. Reading exactly 9 bytes and hoping they match the input stream is not very effective, as you found. If you are out of sync with the incoming bytes, you will stay out of sync.

It would be better to keep reading (single bytes) until you get 0xFF or 0x86 and then read the rest.