Schwartzman's 4-6, 7-5, 7-5, 6-4 upset is just his second win over a Top 10 player and moves him into the second week of a major for the first time.
The Argentine, seeded 29th, broke Cilic nine times while delivering a huge upset over the 2014 U.S. Open champ.
Schwartzman lost in the first round of all four majors in 2016 so his performance in this year's U.S. Open is stunning.
"I didn't have luck with the draw," Schwartzman said of his lack of success in majors. "I played good matches but I lost. Sometimes you can lose if you play well. I tried to refocus and improve as a tennis player. I try to improve every week and I'm really happy."
Cilic never got his game going on Friday and sabotaged his chances with 80 unforced errors.
Meanwhile, 12th-seeded Spaniard Pablo Carreno Busta also reached the fourth round at the U.S. Open for the first time by rolling over French qualifier Nicolas Mahut 6-3, 6-4, 6-3.
Carreno Busta racked up 32 winners while committing just 13 unforced errors.
Frenchman Lucas Pouille, the 16th seed, moved on with a 2-6, 6-3, 6-4, 6-4 victory over Russia's Mikhail Kukushkin.
Paolo Lorenzi rolled to a 6-2, 6-4, 6-4 victory over fellow Italian Thomas Fabbiano, while 18-year-old Canadian Denis Shapovalov won 3-6, 6-3, 6-3, 1-0 when Kyle Edmund of Great Britain retired with a neck injury.
"It's never good to win this way," Shapovalov said afterward. "Hopefully it's nothing too serious. Kyle's been playing tremendous tennis. I saw and heard something was up just before he called the trainer (in the third set) but I'm just happy to be in the (fourth) round."