After a second Williams penalty the captain Jon Dampney went over and Williams converted before landing a third penalty to make it 23-7.
North Otago started the second half with two penalties to Keohane as they launched their comeback.
Mid Canterbury then looked to have landed the decisive blow when flanker Kody Nordqvist appeared to have scored against the upright, but referee Brendon Pickerill didn't opt to go to the TMO and instead went back for the penalty, which Williams duly knocked over.
North Otago constantly had Mid Canterbury pinned in their own quarter but the hosts were resilient both on attack and defence.
The visitors eventually broke through in the 74th minute through winger Alex Brown and Keohane slotted the conversion from the side-line for a six point ball game.
There was an intense final few minutes, however, the Hammers held on to become Meads Cup champions.
It was Mid Canterbury's first win in their third Meads Cup final, and first national provincial silverware since 1998, while it was North Otago's first defeat in the Heartland Championship showpiece after wins in 2007 and 2010.
Mid Canterbury 26 (Dwayne Burrows, Jon Dampney tries; Murray Williams 2 cons, 3 pens)
North Otago 20 (J'ndre Liebenberg, Alex Brown tries; Ed Keohane 2 cons, 2 pens)
Halftime: 23-7