Laughing and references don’t have to break immersion
For decades, I’ve been running a table full of amateur comedians. Chiding the players or punishing the players never discouraged the antics. Many players feel like having a good laugh is the point of getting together with your friends.
Telling some folks not to laugh and joke is basically telling them not to have a good time.
Assume popular fiction is in-game fiction, too
Instead of letting laughter and references stop the action, just fold them right into the campaign.
In your example, Game of Thrones could be a hugely popular work of fiction in game. So a player makes a GoT reference while speaking with an NPC, the NPC will simply understand it, or at least understand the PC is referring to popular stories, and the dialog can continue normally.
Role-play will actually improve dramatically when you make it possible for players to express themselves referentially. Easy conversational shortcuts (that people use in real life, every day) become possible in game.
It really doesn’t matter what story players are referring to, don’t let it stop the dialog. Real-world history and fiction set in the current day (or future) can all be “fantastic stories” in the game world.
Laughing in the face of death
A classic technique that never quite did the trick for me was to assume laughter and and odd comments by the players were also said by the characters — and then to “punish” the characters who did not take the situation seriously. Again, this just stopped the action, and pulled the players further out of any immersion.
If, on the other hand, you assume that NPC’s expect heroes sometimes to laugh in the face of death, the conversation can continue. Instead of getting offended and going off in a huff, the NPC responds in a way that allows the conversation to continue (but guides it in the desired direction).
When appropriate, the NPC’s can mildly chide PC’s to take issues seriously, by saying something like, “I’m glad you are not afraid, but a lot of people’s lives are at state. I need to know you are hearing me.”
NPC’s who accompany the party into danger can also help set the mood, by responding with appropriate fear or other emotions.
Reward the players who are displaying correct behavior
When one or two players are just busting a gut at a really busting a gut at an inopportune time, the DM can just focus on the players who are more engaged. An NPC can assume boisterous players have had too much to drink.
Review the Rules of Improv
All of this advice follow Tina Fey’s Rules of Improv, which are always a good read for folks who are having trouble role-playing.