Barca were leading 2-0 in their last-16 first-leg clash thanks to two early Cesc Fabregas goals, but were labouring in their attempts to add to their tally and kill off the tie.
That was until the introduction of Messi half an hour from the end, who was initially ruled out of the game but defied illness to score in the 72nd and 90th minutes and all but Barca through to a likely quarter-final with Real Madrid.
"[In the] morning he had a stomach ache, he was in pain, cold and had a small fever, that's why we decided that he should stay home," Guardiola told the Barca website.
"Afterward, he called and said he was feeling better. [In the] morning we wanted to announce that he didn't train and that he'd been ruled out.
"However, I left him on the bench, we hadn't closed out the game and I decided to put him in for half an hour.
"We know that we're a little bit better with Messi."
Messi explained: "I only had stomach pain, but I wasn't vomiting and my fever broke.
"Seeing that we don't push ourselves too hard during game-day training sessions, I thought it best not to train."
Messi said the cushion was important to take into the return leg.
"It's a good result going into Pamplona, because we know that it's not an easy field and they are strong at home," he said.
"Visiting teams have a really hard time winning, that's why we needed to put in a good performance here."