Here is the item again:
Once classes were over, (A)
Maria used to meet her lab partner Chris at the diner near
campus (B)
until she discovered that Chris preferred,
(C) to flirt with the
waitresses instead of discussing their chemistry homework.
You realized that the comma after preferred is wrong. To flirt with the waitresses ... is an infinitive phrase. When you attach an infinitive phrase to the end of a sentence, you need no punctuation.
To fix this problem, you chose to do this:
Once classes were over, Maria used to meet her lab partner Chris at the
diner near campus until she discovered that Chris
preferred to flirt with the waitresses instead
of discussing their chemistry homework.
You have correctly employed Punctuation Rule 5:
Main clause + Ø + infinitive phrase.
Excellent choice!