It's not an urban legend. Cyntia Nixon of Sex and The City really made a cameo in Forgetting Sarah Marshall.
The rom-com from 2008 is one of the most successful of its kind, starring Jason Segal, Mila Kunis, Russell Brand, and Kristen Bell.

Peter, played by Segel, arrives in Hawaii after his girlfriend, played by Bell, or Sarah Marshall, dumped him. He starts drinking and even says, "I'm on Sex and the City!"
Then in a split of a second, Peter says, "What's up, Miranda?"

And yes, that is Cyntia Nixon playing Miranda in the middle of the romantic comedy, way outside the SATC universe.
Nixon's not credited anywhere, so many thought it was just a look-alike. If you are still unsure, put on this fantastic comedy, and observe as Peter gets into Turtle Bay Resort and starts drinking like there's no tomorrow.
Here's a Youtube video, confirms the lesser-known cameo, which has gone viral since the new SATC series, And Just Like That started.
Nixon is not the only celebrity appearing in the hit movie.
William Baldwin was Sarah's co-star in her fictional show Crime Scene: Scene of the Crime. After, she gets another equally silly role, in Animal Instincts, with Jason Bateman.

Kristen Wiig appeared in the movie in a deleted scene, where she does yoga with Aldous Snow, the rockstar played by Brand.
The movie is one of the best comedies of the 2000s and one of the best featuring Jason Segel, whose Peter is equally annoying as he is lovable.