do{
if (Serial.available()){
firstByte = Serial.read();//read first byte
secondByte = Serial.read();//read next byte
thirdByte = Serial.read();//read final byte
}
}
while (Serial.available() > 24);//when three bytes available
The body of a do/while loop is executed at least once. Suppose that there is only one byte of data to be read. You check that, and then read all 3 of the one available. Oops.
Then, you check that there are at least 24 before the loop is executed again.
A while loop, on the other hand, would not require 2 calls to Serial.available() and would assure that the mistake made here didn't happen.