Richard Harris was known to my generation for playing King Arthur in the movie Camelot. You may know him better as Albus Dumbledore in the first two Harry Potter films. He relinquished the role when he died in 2002 of Hodgkin's disease. Harris had been staying at the Savoy Hotel in London while his condition swiftly deteriorated. He was eventually carried out in a stretcher and sent to the hospital. As he was carried past hotel guests, he yelled, "It was the food!" That had to cause some panic among those who had dined there. As far as we know those were Harris's last words.
But he wasn't alone in using his last words as a joke, or to confuse people, or to get back at someone. Read about five men whose last words were a first-class example of trolling. It's likely they didn't know those would be their last words, but they were nevertheless clever.