"I have a static platform moving at one point in the level. I know im not supposed to do that, but its not anywhere near where this problem is occurring."
Ooohhh.... So here's a crazy hunch. Are you not calling one of the cpSpaceReindex*() functions promptly after moving the platform? So when the raycast descends the tree's nodes, it checks the two children in the order that the raycast intersects their bounding boxes. That way if the raycast hits something before it would even enter the second child node's bounding box, it knows it can skip that subtree. If you don't reindex a shape after moving it, then AABB node in the tree (and any of it's parent nodes) will have out of date bounding boxes. If the raycast hits both the out of date bounding box in the tree AND the shape after it's been moved it could definitely cause it to incorrectly reject entire subtrees. If it happens in the first few levels of the tree then the proximity of the platform is irrelevant. It can still cause nearly random false negatives across the entire indexed space.
Also, if you are moving a static shape, then you really want to be using a rogue (not added to the space) body. Create a body with infinite mass and moment, don't add it to the space, and manually update it's position and velocity.