The machine was stolen from a Miller Homes site in the town.
The thief drove the JCB through site hoardings before being spotted by a passing police car which “chased” the slow moving machine.
The robber hit the marked police car during the pursuit and finally came to a halt in a muddy field where he was arrested.
Nobody was hurt in the incident.
Jackie Morrison, whose bungalow overlooks the field, told gazettelive.co.uk: “When I came through to the front and looked out of the window the police car was already there with its left hand side all stoved in.
“The road was blocked off with lots of police cars.
“It was dark and raining so I couldn’t really see what was in the field.
“We watched it unfold and when the incident van came, they were all going into the field.
“We thought it was going to be a car.
“When we saw it was a JCB we were absolutely gobsmacked.”