The 12th seed's usually-dependable serve deserted him during the opening two sets, as he was broken four times. He also produced 38 unforced errors.
Those errors soon became winners as Cilic somehow regained his composure just in time to keep his hopes at Flushing Meadows alive.
He made only 25 unforced errors in the final three sets and he faced just one break point, eventually prevailing 5-7 2-6 6-4 6-2 6-4.
Germany's Daniel Brands will provide the opposition for Cilic in the next round.