From Tom Dalzell & Terry Victor, The New Partridge Dictionary of Slang and Unconventional English (2006):
oh snap! used as a mild oath US [Cited example:] [oh snap!]—Connie Eble (Editor) UNC-CH Campus Slang, p. 8, October 2002
The initialism "UNC-CH" stands for "University of North Carolina at Chapel Hill," where Eble is a professor of English and comparative literature.
The derivation of the term is not entirely clear. It is certainly possible, as FumbleFingers and John Lawler note in comments beneath the posted question, that the expression is simply a euphemism for "oh shit!" But a several other factors may have influenced its emergence.
Three potentially related expressions appear in Jonathon Greene, Cassell's Dictionary of Slang, second edition (2005), which does not have an entry for "oh snap!" itself. Here they are, in chronological order:
snap! excl[amation] {1970s+} (US Black/teen) 1 an excl[amation] of surprise or apology, esp[ecially] after making a mistake or blunder. 2 an excl[amation] of displeasure. {[from] SNAP v6 ["to convey displeasure by directing a loud fingersnap toward the offending party."]}
snap n4 {1980s+} (US Black) a wisecrack, a witty retort. {[from] SNAP v4 ["1 to tease. 2 to laugh along with.]}
oh smack! excl[amation] {1990s+) (US teen) a reaction to something astonishing, an excl[amation] expressing the sudden realisation that a thing or a situation is pleasing. {[from] fig[urative] use of SMACK n1 (3) ["a blow, a slap."]
A further sense of snap as a verb, dating to the late 1970s and reported by Dalzell & Victor, also seems relevant:
snap verb 1 to insult someone in a semi-formal quasi-friendly competition US
Yet another Dalzell & Victor entry is intriguing but probably unrelated, given its early origin date (the late 1950s) and location (the UK):
snap! used for registering a (usually minor) coincidence UK [Origin:] From the children's card game during which players cry 'snap!' whenever matching cards are exposed.
My earliest exposure to the expression "oh snap!" was through Darby Conley's comic strip Get Fuzzy more than a decade ago. Conley used the expression with some regularity, typically in a sense that seems much closer to "you just got verbally [or otherwise] burned" than "oh shit."
For example, from a Get Fuzzy strip published on April 19, 2005:
Satchel [the dog]: Ooo! The mail slot!
Rob [the human]: Mail? At this hour? What is ... Could that be ... That looks like ...
Bucky [the cat]: Ferret droppings!
Satchel: Oh, snap! You got served!
And from a strip published on June 25, 2006:
Bucky: I have fastened – at great personal expense – a rat toy to this noose. Ratbirds, seeing this will swoop down for a quick—
Satchel: I don't think there's such a thing as a ratbird. Now, an owl might eat it.
Bucky: Oh, I'm sure I've heard of a ratbird ... See, that means they feed on rats ...
Rob: So what's a catbird?
Satchel: Oh, ho ho! Snap!
And from a strip published on June 28, 2006:
Rob: Ohhh, no, no. Whiskey is not for kitty.
Bucky: Hey! Why not?
Rob: Because it's basically a drug, Bucky.
Bucky: And how is that different from catnip?
Rob: It's totally different! It's ... well, it ... hmm.
Bucky: And then he took all my catnip away!
Satchel: Oh, snap!
And from a strip published on May 3, 2007:
Stank Lloyd Wrong [cat architect]: What did you just say about the Patronas Towers?
Satchel: Nothing. I just mentioned them. ... They're, like, the tallest buildings in the world, right?
Stank: You take that back or I'll hit you so hard Andrea Palladio won't be able to make your face symmetrical again!
Bucky: Oh, snap!
This usage seems to match the sense that DTR RTD cites in an answer posted earlier today.
I suspect that different US English speakers use "oh snap!" variously to euphemistically express the exasperated sense of "oh shit" or to convey the humorous sense of "you got burned!"—and perhaps in other ways as well, such as the "an exclamation of agreement or acknowledgment, often used in response to an insult" meaning cited by the Oxford Languages dictionary and quoted in Chappo Hasn't Forgotten's comment beneath the posted question. None of these specific meanings strikes me as being entirely on point in the instance of "oh snap!" that the poster asks about, although that instance may very well amount to exclaiming "oh shit!" or "I agree!" or "I'm too nervous and excited to think of anything coherent to say!"