Agreed there is a problem and both answers above are correct depending on what version of QBO you are hitting.
Looking at a Classic QBO company file, classes are at the line level and not at the invoice level.
But if you look at Harmony QBO company file (new format), classes are at the invoice level and not line level.
I have submitted bugs to QBO and for the docs to add clarifications.