I thought about this for a bit and suggested some debugging ideas, and finally thought, "Oh, maybe this could be the problem." I checked:
that hypothesis was the problem.
It was my fault; it was in the document clustering code.
The bug had gone unnoticed for three years (and the code had gone through code review).
It was fixed by removing a single character.
I am simultaneously proud for spotting this and embarrassed for having made the error in the first place.
I'll let the C++-heads think about this before reading
The function being called involved a reference parameter.
The reference parameter was being passed a temporary.
A data structure returned by the function was keeping that reference past the lifetime of the function.
The optimized code was being more proactive about reusing the storage used for that temporary, and that was wreaking havoc on the data structure that had the reference to the stale temporary.
The solution was to remove the '&' to turn the reference into a copy.