(LifeWire) -- They ate lunch together almost every day. They commiserated over professional and personal woes, and when projects ran long at the San Francisco architecture firm where they were both summer interns, they checked building plans together until they were sprung from the office at 10 p.m.

Take care that a flirtation with a co-worker doesn't cross the line.

"She was fun to hang out with, and sometimes she would do things that some might consider flirty, like run a hand through my hair to mess it up," says Hayes Shair, now 25. "Sometimes I'd sort of flirt back."

But Shair was dating his college sweetheart at the time. This woman was more like his "work girlfriend" -- a coworker with whom one flirts platonically during office hours but without any romantic intentions.

It's hardly a unique situation. The career information Web site Vault.com reports that in a 2007 office-romance survey of 575 employees, 23 percent said they had a "work husband" or a "work wife."

As with real spouses, work spouses turn to each other for mental and emotional support, perhaps share inside jokes or even bicker like married couples. But that's where the line is drawn.

Having a work spouse can give you an emotional connection without a professional nosedive. Heidi Reeder, associate professor of communication at Boise State University in Idaho, says it can be a good thing.

Good for work?

"There are some cases where the motivation of flirting is to get the person into bed. But I think what a lot of people don't realize is that there are other reasons why people might be motivated to flirt, like developing a positive relationship with the person with compliments and touch," says Reeder, whose teaching specialties include gender and workplace communication.

Don't Miss Worst things to say at work

"It's an esteem booster for both men and women to have a little flirtation in their day -- it makes them feel a little better, gives them a little more energy."

Liking your co-workers might make you more excited about coming to work, too. "You're happy to see them," Reeder says, "instead of, 'Ugh, I hate these people.'"

In fact, flirting might even have some indirect benefits on the job, says Reeder, citing research conducted at the University of South Alabama in 2003 showing that people who don't flirt very much have lower energy levels and rate themselves as less attractive than people who flirt a lot.

"It seems like having higher energy levels and thinking that you're attractive might help you make the sale, and it can help you be more responsive to your partner in the bedroom," she says.

Flirting with trouble

Of course, there is always the risk that platonic work flirting may be asking for trouble.

Last summer, Cheryl, 26 -- happily married for two years and six months pregnant with her second child -- found an easy self-esteem boost in her work boyfriend's adulation. "He fawned over me, complimented me on my cutting wit, my sassy outfits and sizzling personality," she says, which left her "flustered and giggly schoolgirl-ish."

Though her husband complimented her constantly, his words paled in comparison: "It's like how your mom always tells you you're beautiful. It's expected," she explains. "Getting the compliments from an outsider was refreshing."

Cheryl, who asked that her last name not be used given the sensitive nature of the topic, had no intention of starting an actual affair. In fact, even though she was suffering from a waning sex drive because of her pregnancy, her work flirtations sparked a flame at home with her husband. But eventually the office flirting crossed a line, and she had to stop it.

"Over the months, our banter had more of a sexual overtone, at times downright raunchy," Cheryl recalls. Moreover, she became obsessed with his affection, and jealous when he flirted with other female coworkers.

Cheryl, now tending to her two young children in Wisconsin, acknowledges it wasn't her finest hour. Was it emotional cheating? "Probably," she says.

"When our conversations became so explicit I couldn't repeat them to my husband, I knew I had to cut it out," she says. "And I did ... though it wasn't until I quit working to become a stay-at-home mom and he started dating someone at work that the book finally closed on that chapter."

Where to draw the line

Is your work marriage crossing the line? Reeder outlines some questions to ask yourself:

• Would you behave the same way if your romantic partner were standing next to you?

• Are your flirtations consistent with the way you normally behave?

• Are you thinking about your "work spouse" while not at work?

• Do you compare your "work spouse" to your real romantic partner?

As flirting can include physical contact, even though the intent is innocent, it is wise to keep in mind how such behavior might be misinterpreted by some people.

Shair, now a graduate student at Columbia University in New York City, doesn't make too big a deal of his work relationship.

"What were we supposed to do to prove that we were just friends? High-five each other?" E-mail to a friend

All About Jobs and Labor