As I understand the facts, the car was totaled in an accident. As a result, the ex-husband received $X from either the at-fault party's liability insurer or from collision coverage that was maintained on the car. The ex-husband paid the $X to lender (why the money wasn't paid directly to the lender isn't clear, but it's unimportant), leaving a $1,000 balance on the loan.
Is all that right?
If so, then I agree with comments that the OP's liability for the $1k balance of the loan is clear. The agreement required "that Wife [will] timely pay all costs, expenses and liabilities associated with the Beetle, including but not limited to the loan." The language that makes payment of the loan a condition to the OP's use of the vehicle would almost certainly not be interpreted to saddle the ex-husband with the loan balance under the circumstances, especially given the frequent use of "defend and indemnify" in the agreement.
Obviously, the way to protect against this situation was to obtain gap coverage.
As a practical matter, it's $1,000. It's not worth going to court over this.