The 29-year-old goalkeeper, who has spent the last two seasons at the Galpharm Stadium following his switch from St Johnstone, has already featured in more than 100 matches for Town.
Ternent said: "I'm pleased to have Matt signed up. I rate him as highly as any goalkeeper in this League and I see him as an integral part of the squad."