In the shadow of the Empire State Building at a playground in bustling Madison Square Park, my daughter uttered the words that must send shivers up the spines of every parent in New York City.

“I have to go potty.”

The breathless bathroom quest that followed resembled one of those old Keystone Kop movie chases. I bumbled my way around the perimeter of the park, running in one building entrance and out another (“Sorry sir, no public restrooms”), jumping around hot-dog carts, dodging traffic, all the while holding my daughter in my arms while she held her own. Finally, I rushed past the front desk at a 24-hour fitness center straight into the men’s locker room, the sight of chunky, hairy, naked men providing unlikely relief — especially hers.

Getting out of that caper with dry pants was just one of many small victories my wife and I claimed during a five-night stay in New York City last April with our two daughters, ages 4 and just barely 1. Yeah: What were we thinking?

Actually, we thought through the trip pretty carefully ahead of time and picked up lessons along the way — enough for us to consider doing it again. The hassles of New York seem amplified with young children — but so does the city’s majesty.

Out first and best idea was to forget Manhattan’s closet-sized hotels and look into vacation rental options in Brooklyn. My wife and I already knew this from our NYC treks B.C. (before children): A few extra subway stops across the Hudson River will get you exponentially more for your lodging dollars.

Via, $250 per night got us the ground-level apartment of a three-story walk-up in the brownstone-lined Fort Greene neighborhood with a kitchen, two bedrooms and even a cute little back patio for breathing all that fresh Brooklyn air.

The stereotype of today’s Brooklyn looking like the Pitchfork Music Fest gone amok with hipsters on every corner holds true, but the historic borough is also still home to young families of all stripes. We found plenty of nearby playgrounds and kid-friendly (but still hip) restaurants. Some of our favorite kid-centric attractions were in Brooklyn, too.

Brooklyn state of mind

First and most obvious among those sites was the Brooklyn Children’s Museum, opened in 1899 and credited as the first museum for kids in America. It’s certainly one of the biggest and best, especially after an $80 million expansion in 2008. My older daughter and I spent a half-day there while Mom and baby shopped, and we didn’t get bored nor see the whole thing.

Lest you think shopping is a mere half-day venture for my wife — I got to cut away to see the Twins at Yankee Stadium one afternoon, so I wasn’t complaining — Lila and I spent the second half of that day at the Brooklyn Botanical Gardens, a maze of trees and fantastical plants that would set any kid’s imagination ablaze. Their rows and rows of cherry blossom trees were in bloom, with a medium wind sweeping through them. The sight of my pink-cheeked girl spinning and jumping to catch every pink petal falling off the trees will stay with me forever.

Brooklyn’s crowning jewel for kids, however, is actually something you can see in just about any city: a merry-go-round. None compares to Jane’s Carousel, though.

Built in 1922, this especially merry go-round was bought on auction in 1984 and painstakingly refurbished by Brooklyn artist Jane Walentas until it finally rode again in 2011. Famed architect Jean Nouvel designed a $9 million glass pavilion to house it in Brooklyn Bridge Park, where the backdrop of the bridge and the Manhattan skyline match the shimmer and whir of the circling horses. This is one ride where we didn’t turn down the inevitable, “Again! Again!”

We were heartbroken later to see photos of the carousel underwater during superstorm Sandy. Amazingly, though, it survived relatively unscathed in its glass shell and was reopened in February. You have to hand it to New Yorkers: They might be miserly on public bathrooms, but they know how to rally behind their landmarks, of which Jane’s is clearly now one.

City that never sleeps?

Our entire whirlwind go-around through New York most often got bumpy when we crossed over into Manhattan.

Taking the subway — which we did 90 percent of the time — was pretty easy and felt plenty safe. Any parent not used to the NYC underground may freak out over sanitary conditions, though. Our one and only attempt to take an elevator at one station instead of schlepping all our stuff up the steps, for instance, was thwarted by an overpowering urine stench (4-year-olds aren’t the only ones hard-pressed to find bathrooms).

The requisite trek to the FAO Schwarz toy megastore in Midtown Manhattan — one of several top tourist destinations my wife and I had never seen in our many prior NYC ventures — was spoiled by a sudden rainstorm. On cue, that also wound up being the one and only time we had trouble finding the subway station we needed.

Lesson 1: Always know your escape route. Lesson 2: Have your kids watch Tom Hanks in “Big” before you go, not after, or the whole dancing floor-piano shtick might be lost on them.

Then came the Empire State Building, also a first-time for my wife. We hit the big gray beauty when everybody says to: a midweek morning not in summer. We still wound up waiting in line 45 minutes — a long, crammed line with very little to look at, nothing to snack on and (surprise, surprise) no nearby restrooms. When we finally got to the top, the windswept view proved too gusty for the girls. So our 45-minute endurance test resulted in four minutes on the observation deck.

The Metropolitan Museum of Art was a lot more welcoming, especially the big Egyptian section. And Central Park predictably went over well, from all the princess and knight talk produced at Belvedere Castle to the many playgrounds tucked into the park. Me turning a corner: “Another one?!” My daughter: “Yep. This one looks gooood.”

Bonus points for New Yorker Niceness goes to the woman who let us sneak into a private performance in the park’s Swedish Cottage Marionette Theatre, which came off like an Ed Wood movie set to puppets.

Our biggest problem in Manhattan was simply underestimating the size of the island and going too far trying to see too much. We ran our girls ragged there, and just the sights and sounds of it can be exhausting.

Exactly how far over the line we had gone became apparent one afternoon as we did the quintessential walk back across the Brooklyn Bridge. We couldn’t wait to show our girl the best view of the city.

“There it is: The Statue of Liberty,” I called down to the stroller halfway across the bridge. Silence.

Our high-wired 4-year-old — who has considered naps an inferior pursuit since age 2 — somehow fell asleep atop one of the busiest bridges in the biggest, noisiest city in America. That was our bad, not hers. I suppose we at least owe her one more trip to make sure she gets the full New York experience.