One-putting the last four holes at Bay Hill, the 33-year-old Aussie surged late to claim his first US victory since 2012.
"It just all came together," Leishman said. "To do it here is really good. It was just an unbelievable day."
Leishman fired a final-round three-under par 69 to stand on 11-under 277 for 72 holes at the famed Orlando, Florida, layout in the first event since the death of tournament namesake Palmer, the golf legend who had hosted the event annually.
"Mr. Palmer was a very special guy," Leishman said. "To win it in honor of him was huge."
Americans Kevin Kisner and Charley Hoffman, co-leaders entering the final round, each fired 73s to share second on 278 with McIlroy and England's Tyrell Hatton sharing fourth on 279 and Canada's Adam Hadwin on 280.
McIlroy will jump past Australia's Jason Day to become world number two on Monday with American Dustin Johnson still atop the rankings, but a closing bogey ended his title bid in what became a four-man shootout down the final holes.
"Around here, things can change so quick," Leishman said. "You've just got to stay right in it, not think about what's the end result, just focus on what you've got to do. I was focused on my putts and luckily they all went into the hole."
Leishman's first victory in front of his family was enough to qualify him for the Masters in three weeks at Augusta National, where he shared fourth in 2013.
His only prior US PGA victory had come in the 2012 Travelers Championship.
His lone European Tour title was at the 2015 Nedbank Challenge, although he was a British Open runner-up in 2015, losing in a playoff to Zach Johnson.
- McIlroy comes up short -
McIlroy tapped in for birdie at the par-5 16th to join Hoffman one off Kisner's lead, but Kisner found the rough at the par-3 14th and missed an eight-foot par putt, leaving the trio deadlocked in front as the drama unfolded.
Leishman, who was one adrift, jumped into the lead at the par-5 16th when he reached the green in two and then sank his eagle stunner to leapfrog the leaders and take the top spot at 11-under.
McIlroy stumbled at 18, three-putting from 31 feet for a closing bogey, and Hoffman faltered at 17, finding a bunker off the tee and missing an eight-foot par putt to fall back. Not even his fourth birdie at 18 in as many days could salvage his hopes.
Leishman was short of the green with his second shot at 18, but pitched the ball three feet from the cup and tapped in the tense par putt to reach the clubhouse one ahead of Kisner.
In the last group, Kisner sent his approach at 18 into a bunker and needed to hole it to force a playoff. When the ball rolled four feet wide, Leishman had the victory.