Things that happen in the nick of time occur just in time, with no extra moments to spare. When you catch a streetcar in the nick of time, you may have to run and jump on the departing vehicle.
Doing something in the nick of time means you almost missed the opportunity: you might catch your dropped phone in the nick of time, just before it falls in a lake, or fix an embarrassing mistake in your school newspaper in the nick of time, right before it's published online. This phrase has been used since the 1600s, and it may stem from the custom of carving a nick in wood to tally hours as they passed.