They both sound right and I've found examples of both. Is there a slight difference in meaning?
The dream itself, which seems to occur in a nick of time, is in some ways nearly timeless, for we can often remember it as a cluster of simultaneous scenes which we have to sort out in their time sequence when telling or writing them down, and in innumerable instances people say: “And then there was somehow another scene, but I do not know where it belongs in the sequence.”
Source: Psyche and Matter (1992) By Marie-Louise von Franz
From the observer's seat, the show was a chain of mini-productions, each one happening in a nick of time. Pull a jumper into the show course, coil the rope, pick up the Air Chair guy, then three more jumpers, doubles, around-the-boat slalom. The 30 minutes seemed like five.
Source: Boating Life (magazine) 1997
and
“ You were a wee one, […] I dropped the reins just like that and caught you just in the nick of time. Ah, that was a close shave, and it put such a fright into you, sure and glory be to God, I didn't know how I would stop you from crying, and I took you into a store and bought you a penny's worth of candy.”
Source: The Face of Time (2008) By James Thomas Farrell