Yes: no changes where necessary to see the problem from the version downloaded from gist when I double checked before submitting the question.
I need to talk to our IT people to upgrade from 0.4.0 to 0.4.1. It might take a few days.
The problem seems to be quite sensitive to all the environmental factors. In your eyes does the code in firstLast() (lines 19-32) look solid?
I also noticed that the code is about 2x slower on GPU than CPU. I am optimizing a re-written version of what I need that does not seem to cause the problem. But I am worried the problem could crop up elsewhere without me noticing.