They both sound right and I've found examples of both.
I believe the "in the nick of time" (the popular usage) is short for "In the last nick of time", with nick being a unit of measure. In which case, to do something at the last possible moment would be "in THE nick of time" or "in THE LAST nick of time", whereas to do something QUICKLY would be to do it "in A nick of time"
I've always seen it as "the nick of time"
Could you give any examples of where 'a nick of time' has been used?
EDIT: After some more thought
I have always understood a nick to be a small piece of something, for example if I were to say
I took a nick out of my penknife blade
In which case using 'a nick' would be valid if you were to say say
There is a nick in my penknife blade
When referring to time you wouldn't be able to use 'a nick' in the same way as 'the nick' though
I suspect that if "in a nick of time" was valid, it would have a different use case than "in the nick of time" but I've never seen it used. It doesn't really sound right either, since there are no "nicks" of time. I know, I'm a Nick!
He finished his drink in a nick of time, so they could leave as soon as possible.
He jumped in the nick of time to avoid the train.