AMONG the many behind-the-scenes insights included in a new homage to Billy Wilder’s “Some Like It Hot,” is a tasty tidbit about the gender-bending farce’s unforgettable last line.

The scene, in which the late Jack Lemmon’s cross-dressing character “Daphne” reveals to a millionaire suitor (Joe E. Brown) that he is really a man, is arguably one of the greatest comic set pieces of all time.

The suitor’s response – “Nobody’s perfect” – became an instant classic on the film’s release in 1959. But, according to the new coffee-table book “Billy Wilder’s Some Like It Hot” ($150, Taschen), it was written on-the-hop as a throwaway line.

In one of his last major interviews before his death in June, Lemmon told author Dan Auiler that Wilder and co-writer I.A.L. Diamond never finished the script before shooting began.

“I know that when it came to the final scene, they didn’t know how to end it and they knew they wanted a punchline for a change to end the film, but they didn’t know what it would be,” said Lemmon, who recalls that he “literally fell off the goddamn couch” when he read the first 60 pages of the script.

Finally, Diamond came up with “nobody’s perfect.” Wilder wasn’t thrilled but agreed because the scene had to be shot the next day.

“So they shot it, they liked it, and they kept it,” Lemmon says. “And of course it was a classic, but they had no idea how strong that line was when they did it.”

“Billy Wilder’s Some Like It Hot” is essentially a love letter to one of the auteur’s most revered films, released this month to celebrate his 95th birthday.

It features the entire script, on-set shots, and hundreds of photos from the film, which starred Lemmon as the air-headed “Daphne,” Tony Curtis as prim-and-proper Josephine and Marilyn Monroe as the voluptuous, ukulele-playing singer Sugar.

There’s also a scrapbook section of film memorabilia, interviews with the major players and a replica of Monroe’s original, annotated script, which recently sold at a Christie’s auction for $60,000.