The Irishman went off with an injured knee during Saturday's 3-1 win over Hearts and initial assessments have shown damaged cartilage.
McNamara revealed the 23-year-old might need surgery to tidy up the knee.
He said: "Gav Gunning came off last weekend and it now looks like we could miss him for the rest of the season.
"We still don't know the full extent but we will find out soon enough.
"It's disappointing because he has done well for us. Especially at this stage, with cup games and the last bit of the league to go."
McNamara might look outside the club for reinforcements but Brian McLean will slot in at centre-back for Saturday's trip to face Clydesdale Bank Premier League leaders Celtic.
McNamara said: "Brian did very well when he came on against Hearts so we will see what we are going to do."
Striker Jon Daly looks set to shake off a knock in time to face Celtic but there is a doubt over former Celtic midfielder Willo Flood.
"We are waiting on Willo, he was ill at the start of the week so hopefully he is a lot better on Friday before the game," McNamara said.