Jimmy replayed the process of him entering the factory in his mind over and over, not missing out on any detail, starting from his entry to the factory, hearing a sound, entering the building, discovering the suspect, firing his gun, Sam coming in and firing, heading off to the side to flank the suspect, and firing his gun. He endlessly replayed the whole process in his mind until he finally figured out under what circumstances that mysterious feeling was triggered.
The first time it happened was when he was hiding with his back to the suspect, and his eyes caught sight of the suspect's gun. He fired and then ducked for cover again. It was only when he had this premonition that he was able to quickly spot the tiny target of the gun barrel and then shoot.