The nick that was being referred to was a notch or small cut and was synonymous with precision. Such notches were used on 'tally' sticks to measure or keep score.
The expressions 'keeping score' and 'keeping tally' derive from this also and so do 'stocks' and 'shares', which refer to the splitting of such sticks (stocks) along their length and sharing the two matching halves as a record of a deal.
To Shakespeare and his contemporaries if someone were 'in (or at, or upon) the (very) nick' they were in the precise place at the precise time. Watches and the strings of musical instruments were adjusted to precise pre-marked nicks to keep them in proper order.
The 'time' in 'the nick of time' is rather superfluous, as nick itself refers to time. The first example of the use of the phrase as we now know it comes in Arthur Day's Festivals, 1615: Even in this nicke of time, this very, very instant.
The English language gives us the opportunity to be 'in' many things - the doldrums, the offing, the pink; we can even be down in the dumps.
My gratitude to http://www.phrases.org.uk for clearing up this matter for me.