"I'm not sure 2-1 is ever comfortable, but from our perspective we deserved to win," Nigel Pearson said.
"We were dominant and a little unlucky to concede a penalty because there was a foul on Kasper (Schmeichel) leading up to the incident.
"I think we played with confidence and created some good chances as well."
Pearson praised his side for holding firm after Cardiff had pulled a goal back.
"There have been suggestions we look jittery when we concede a goal but I thought we coped with that well and stayed the dominant side to win well," he said.
Pearson reserved special praise for two-goal hero Gallagher who was recalled after he was left out of the side beaten at Brighton last week.
"We know what Gally can do. He was left out of the side and was back in today and responded with two goals," he said.
"His work rate was very good as well."
Cardiff manager Malky Mackay berated his players for their slow start to the game.
"I'm disappointed because in the first half we didn't get out of the blocks," he said.
"But it didn't help when one our our main players, Aron Gunnarsson, went off early on.
"We were playing a good team who we didn't get close enough to in the first half and allowed them to play too much.
"We competed better in the second half and after our penalty we caused them a few problems with our forwards Kenny Miller and Rudy Gestede.
"It was always going to be tough coming here. They have a good manager and a fantastic squad and you always have to be ready to match them and I don't think we did that until the second half."