Hamrlik skated left and faked a shot before passing to Peca, who fought through a check on his way to unleashing a vicious wrist shot past Jose Theodore 4:44 into the third period.
Peca tallied his second shorthanded goal of the season after spending most of the game shadowing All-Star center Saku Koivu. Peca's work helped end Koivu's five-game point streak as well as the Canadiens' five-game unbeaten run (3
The Islanders had evened the score 65 seconds earlier on a broken play. Canadiens defenseman Patrick Traverse slipped as he chased Alexei Yashin and slid into Theodore.
As Theodore struggled to get up, Yashin skated around the net and had an easy opportunity for a goal, but the puck was rolling and came sideways off his stick. Oleg Kvasha managed to tip it over Theodore's sprawling body to put New York on the board.
Mark Parrish added an empty-net goal with a minute left to provide the final margin.
Niklas Sundstrom gave Montreal the lead 5:55 into the game when he scored his 100th career goal.
Sundstrom started the play with a pass from behind the net to defenseman Karl Dykhuis at the right goalpost. Garth Snow could not hang on to Dykhuis' shot and the rebound came to Joe Juneau. Snow committed himself to the possibility of a shot, but Juneau found Sundstrom at the right post for an easy score.
The goal was only the fourth of the season for Sundstrom, but it was his second in four games since joining the Canadiens from the San Jose Sharks in a trade on Jan. 23.
Parrish came close to leveling the score with less than two minutes left in the first period, but his backhand shot from a sharp angle spun unluckily after kissing the inside of the left post.
The Islanders found themselves behind at the first intermission despite holding a 15-6 advantage in shots. New York had a 23-13 margin after two periods and a 31-23 advantage for the game.
The Islanders moved four games over .500 for the first time this season and leaped over the Canadiens into seventh place in the Eastern Conference playoff race.
Montreal suffered its first regulation loss in seven games under new coach Claude Julien.
Swim Week Miami Beach 2014 [PHOTOS]