dude, nice one!
I wonder if what you've found tho' is perhaps a different issue, as what i have observed is subtly different to what you see.
what i was seeing was a different number of threads that would hang each time i ran the script. if i ran the script with 10 threads i would get about 4-7 threads that would hang.
thanks for your proposed solution and your effort in testing this out in multiple environments! unfort, in a production env with multiple 100's of thousands of customers (and this really being a one off deal) i wont have the opportunity to upgrade to 5.10.0. it is something to keep in mind for the future tho', and perhaps i can initiate a longer term initiative.