Good question. The Matthew text certainly seems to square with the Book of Jonah. In chapter 1 the pagan sailors become worshippers of God (1:16). In chapter 3 we see the whole city of Nineveh repenting (the sackcloth and ashes included the animals). The repentance was, to some degree, in compliance with the king's decree. The Ninevites thereby escaped the imminent judgment of God on their city. Did this mean that every single Ninevite really trusted in God and was eternally saved? I guess I would have to say that I doubt it. I think that some may well have come to faith, but how many, I don't know. The repentance that was called for was with regard to their sins, and God's judgment. At least that whole generation was spared.
If we were to liken Nineveh to Sodom and Gomorrah, it would seem that God would spare the city if some of its inhabitants were righteous(Genesis 18:20-33).
We see a national repentance (again, at the king's urging) under Josiah in 2 Kings 22. God's wrath was about to be poured out on Judah. When the scroll of the Law was recovered and read, Josiah was convicted of sin, along with others. God was then sought, and judgment was delayed. Once again I would say that there was a national repentance that spared the nation from divine judgment for a time. But I doubt that we could say that all that generation were truly converted and thus eternally saved.
Now back to Matthew chapter 12. Our Lord had come not only as a prophet to the nation Israel, but as its Messiah. Both John the Baptist and Jesus proclaimed a message of repentance. Unlike the Ninevites of Jonah's day, or the people of Judah in Josiah's day, the nation Israel did not repent. Thus, God's judgment was soon to fall upon the nation Israel (70 A.D.).
In my opinion the short answer to your question must therefore be that the whole generation was spared from immediate judgment, but that a smaller number were saved from eternal judgment. This afforded those spared the opportunity to be saved, and thus escape eternal judgment. Otherwise, it would be appointed to them once to die, and then the judgment (Hebrews 10:27).
I think it is not always easy to separate the individual from the nation in the Old Testament. It is not always easy to equate Old Testament events with salvation. For example, I don't think that all who were passed over and escaped from Egypt were true believers. Neither do I find reason to conclude that all who physically entered the Promised Land were believers, either. Some were; others probably were not. But then this isn't all that different from today. There are lots of church members, but not all members are saved.