It’s 5 p.m. on a Thursday, and Margaux Guyonneau is holding court behind a well-stocked bar. Into three lowball glasses, she plunks ice cubes, pours rye, then stirs in spoonfuls of powdered sugar. For a final flourish, she tops each drink with an orange slice.

Guyonneau works with the same flair as any bow-tie-clad bartender — but the 23-year-old digital strategist is in, of all places, her office: the JAR Group, a digital marketing agency.

It could be a scene straight out of “Mad Men” — if Don Draper traded his beloved Canadian Club whiskey for WhistlePig rye and ditched the Madison Avenue corner office for a sun-drenched DUMBO loft.

The office cocktail is alive and well in New York’s tech and marketing industries: Companies such as tech Web site Mashable and digital marketing agencies Carrot Creative and Huge tap kegs and crack open cold beers at the end of the week and to toast new employees, while larger-scale agencies such as DraftFCB and Grey use communal spaces for boozy gatherings.

But others, like JAR, are shaking up the daily grind even further by building fully-stocked bars in their offices, hosting cocktail-making competitions and otherwise bonding over booze.

“We learn about each other’s personal lives, what’s happening out in the world and kick around ideas for clients,” says JAR Group CEO A.J. Lawrence, 43, who had a bar made from reclaimed wood built in the office’s kitchen area in September.

“We have a lot of the same feelings [as Don Draper] of being a small, young agency trying to get attention and get things done.”

His 16 JAR employees typically enjoy a happy hour cocktail three or four days a week, at about 5 p.m. There’s usually a beer on tap, an array of local liquors — Breuckelen gin and Cornelius applejack, among them — as well as an assortment of grapes, chocolate-covered pretzels and peanuts. After a half-hour milling around the bar, employees head back to their desks — drink in hand.

Sometimes the office hosts drink challenges to see which employee can concoct the best one — drawing inspiration from recent trips to client events.

But drinking in the office isn’t just good for employee morale — it also might boost the bottom line. Last year, researchers at the University of Illinois at Chicago found that slightly intoxicated participants were better and faster at creative problem-solving tasks compared to their sober counterparts.

“In general, being able to focus or control your attention is a good thing for most cognitive tasks,” says Andrew Jarosz, one of the study’s authors. “But sometimes too much focus may not be the best thing.”

At Campfire, a TriBeCa-based marketing agency, weekly “Thirsty Thursday” sessions were born two years ago, after earlier attempts to eat lunch together on Friday afternoons eventually morphed into people just chowing down at their desks — because they were too busy working to socialize.

“We just looked at it and realized, ‘You know, it’s not as social and happy [anymore], people eating at their computers,’ ” says partner and CCO Mike Monello.

Each week, one or two employees are tasked with creating a cocktail and sharing a personal story behind the drink.

Recently, about a dozen co-workers gathered in the kitchen area at about 5 p.m. to nibble on cheeses, charcuterie and olives, as 37-year-old Sascha Uzzell popped open a bottle of Prosecco, pouring its contents along with Bombay Sapphire into a pitcher to create a deceptively potent gin fizz infused with rosemary and lemon.

“My mom had a rosemary bush back home,” Uzzell said. “So this reminds me of summer as a young adult.”

The, ahem, “spirited” gatherings are a welcome respite toward the end of a long week — and have fostered friendships among employees who, thanks to the increasingly 24/7 nature of the workplace, are spending more and more time with each other.

“In tech, there’s more of a blending of life and work that’s not so separate,” concedes Monello, a 43-year-old Park Slope resident. “When you have those intense collaborations, the more you know people, the more comfortable you are, and the easier it is to do incredibly difficult projects in a very short amount of time.”

Experts say on-the-job drinking reflects the new office work culture, where open seating plans are common, higher-ups mix with new hires and the lines between work and play blur.

“On ‘Mad Men,’ you see a lot of ad execs pouring expensive drinks in their offices — today this would be more of a red flag in the office, drinking alone. The office culture has become a more casual, more communal experience,” observes Business Insider advertising reporter Laura Stampler.

“It also keeps people in the office longer. If you’re asked to spend a whole weekend in the office, you might as well have a beer as a reward.”

That work-hard, play-hard philosophy still rings true in the more traditional madcap advertising world.

Employees at BBDO — the agency that supposedly inspired “Mad Men” creator Matthew Weiner’s martini-soaked version of Sterling Cooper — still frequent its now-famous 37-year-old office bar, Central Filing, on the seventh floor of their building.

“Our forefathers recognized for people at work in businesses like advertising, there aren’t set 9-to-5 hours,” says BBDO CEO John Osborn of on-the-job fraternizing. “It’s a service-oriented business, so you always have to be on call.”

For a $50 fee, BBDO employees can gain access to Central Filing and its legendary red-vest-clad barkeep, who’s simply known as Joe the Bartender. (The bar is temporarily closed for renovations, so an office “pop-up” now stands in.)

But, flying in the face of the three-martini lunches made legendary by the industry, the bar only operates after normal business hours — and promptly closes at 7:30 p.m.

Were any “Mad Men”-style mishaps — a leg severed by an errant lawn mower, for example — responsible for such an early last call?

“As for stories,” Osborn cryptically says, “they’re all buried in the filing cabinets of Central Filing. And they’re all sealed shut.”