Depends on how long you have been in the job. If you're still on probation, I would suggest you quit, as it won't be very difficult to fire you.
On the other hand, if you are beyond probation, I would advise you (to the extent that I can advise you - I'm a chartered secretary rather than a solicitor) to stay because I think it would be very unlikely for you to be fired for a first offence. You'll more likely receive a written warning.
'Gross misconduct' offences can generally lead to being fired for a first offence, but I'm struggling to be convinced that an employment tribunal would accept that clocking in five minutes early could be defined as 'gross misconduct.' Normally, this is reserved for illegal or borderline criminal offences like sexual harassment, spending hours on the internet at work or stealing. If your employer thinks the same way as I do, they might be reluctant to risk firing you for a first offence. I'd be interested to hear an employment solicitor's view on this.