Requisite disclaimer: I'm not a lawyer, and this is not legal advice.
This is a good question! Its answer depends on how the people who own the rights to the referenced game view the reference itself, which is not an easy thing to predict. They might see it as a nice homage, or they might think it violates their copyrights, trademarks, intellectual property, and so on. If they view it that way, what they decide to do about it would depend on how much they thought it was worth to pursue the matter. The more the reference looks to them to be duplication rather than homage, the more motivated they'd be to shut it all down. A Cease and Desists is (almost) always the first step they would take. If you remove the reference, it's likely they'd be satisfied and it would all end there. Legal action is expensive for them too, so they're unlikely to sue someone over a small reference if that reference is removed after a Cease and Desist is issued.
For example, let's say you're a Firefly fan, and you decide that a character in your game wants to call things she likes "Shiny." I'd think you were fine. Name her Kaylee and make her the mechanic on a space ship owned by smugglers who wear brown coats... now you should expect a Cease and Desist.
Cease and Desists do get issued, sometimes over really little things! Because of this, I'd think it would be a good idea to employ references to other works only within elements you can easily remove from your game with a patch, rather than anything integral to mechanics, levels, characters, plots, etc.
Hope this helps!