Hartley's kick came on a low trajectory and fluttered, barely managing to split the uprights. His third field goal of the game was good enough to cap a seven-play, 51-yard drive in the final 1:14 with a win for the Saints (2-0).
Drew Brees (28-of-38, 254 yards) completed a key 30-yard pass to Marques Colston to the San Francisco 18 to set up the winning kick.
Brees tossed a pair of touchdown passes and didn't throw an interception in the New Orleans victory and Pierre Thomas hauled down eight receptions for 57 yards.
The 49ers (0-2) had forged a 22-22 tie with 1:19 left when Frank Gore (112 yards on 20 carries) scored on a 7-yard run.
Alex Smith completed 23-of-32 passes for 275 yards and a score but was intercepted twice for San Francisco.
Lytro unveils camera that can focus a photo after shooting it
NASA celebrates Earth Day with #GlobalSelfie