The Ducks lost their third straight despite taking the lead two minutes into the game.
Nashville grabbed a 3-2 advantage in the third period but Ryan Getzlaf tied it with a power-play goal with 10:27 left in regulation.
Hamhuis then came through with a slapshot that got past Jean-Sebastien Giguere.
The Predators won their second straight and moved within two points of Chicago for second place in the Central Division.
Dan Ellis made 32 saves to get the win. Giguere stopped 31 shots.