Heidi used to be very close to a gay man named Charlie and presumably they also lived together like Will and Grace. Grace remembers one Halloween where Charlie dressed up as Cindy Crawford and Heidi went as her mole.
When Grace bumps into Heidi during the third season, Heidi tells her that she and Charlie had drifted apart and don't talk anymore since he had moved to San Franciso. Heidi says it was because there was nothing that was keeping them together such as a house or kids. Grace believes that the same thing is happening or will happen between her and Will, so she finds a way to try and keep them together.