Based on this description alone, it's hard to follow the logic or why it's not working. You say the deployed script updates 1 custom record field to some value by total/sum. What is the script summing up? A value from multiple lines in the invoice?
Also, are these single line invoices, or multi-line? I have had a lot of trouble with multi-threaded CSV imports when dealing with multi-line transactions, so that is one instance where I usually disable multi-threading.