It means that at first, they fell short of paying the full amount. The amount that was still due was 35 cents. E. g., they had to pay 50 dollars and 35 cents (for example, the rent is $50.35), but they only had 50 dollars. So they paid what they had (50 dollars), and they were 35 cents short—they still owed this amount. But then they found an $1 bill somewhere — and when they paid it, their payment was more than they needed to cover those 35 cents. So they became "ahead" by 65 cents in their payment to someone—meaning, they overpaid someone by 65 cents.
This way of speaking comes from thinking about sums of money as a sort of a progression in time. If you look at the image below, X is the correct amount that should be paid (if they pay it, they neither owe money, nor have they overpaid). If you've paid more than you needed to pay, you've sort of "run ahead" of your schedule of payment. If you haven't paid enough, you are "behind".
In fact, there is an idiomatic saying:
I'm behind on my bills.
It means that I have not paid all of my bills; I owe money to my landlord and/or to the utilities companies. One can be, for example "two months behind" (meaning, you haven't paid your rent for two months already). Or one can be X dollars behind (whatever sum you still owe to be all square on your payments).