Properly written: ¡Ay, güey!
It is a very informal Mexican exclamation, similar to "OH, SHIT!" without the
intense level of vulgarity.
It comes from: Ay! - literal translation of exclamation in Spanish of "OH!/ Ouch!"
Güey! - refers to "
dude / chav" hence why it is informal.
Ay wey, tu jefa esta bien buena. - "Oh, dang! Your
mom is so hot."
Ay wey! Casi me caigo! - "Oh, shit! I
almost fell down!"
¡Ay, wey! Ya no tengo dinero. - "Oh dang. I don't have anymore money!"
Ay, wey. Se me pasó el camión. - "Oh, shit. I missed the bus."
— ¡Ay, güey! — Exclamó Eratóstenes. - "Oh fuck!" Exclaimed Eratosthenes.
**Either spelling is equivalent to mean the same
thing, except "ay wey" is more prevalent in informal
writing or among anyone basically (refer back to the fact of being an informal expression). "¡Ay, güey!" is more prevalent in literature but is not exclusive.