I'd replace the tire. But next time that happens on a ride and you see it happening, think about stopping the bike, letting out the air, showing a folder dollar-bill or some duck-tape or something similarly stiff against the sidewall to block the hole temporarily. Then reinflate the tire so you can ride home without (too much) worry.
Then having gotten home, yes, I personally would just replace the tire at that point.