Marshall had earlier repelled Everton with a string of fine saves and it took a deflected Gerard Deulofeu strike to finally beat him just before the hour.
Even then his heroics might still have earned a worthy Barclays Premier League point after Juan Cala bundled in a scrappy equaliser.
Martinez said: "It was a really intense game, Cardiff were very, very good.
"David Marshall in goal was phenomenal, as good an individual performance as you are going to see from a goalkeeper.
"Once we scored that first goal but let Cardiff back in - that was a very difficult moment.
"It became a very difficult test for us and I was pleased that we never panicked and did the right things.
"You can say you get a bit lucky when you score the winner so, so late, but it was down to having that control and patience.
"I did think we deserved the three points but I thought Cardiff deserved huge, huge credit.
"It was a very good performance and a little bit harsh for them to feel what they are going to be feeling.
"You tend to see everything levels up in the course of a season and I hope Cardiff can get many points between now and the end of the season."
For breaking stories and all the great banter like us on Facebook: facebook.com/tribalfootball