The couple played by Casey Affleck and Rooney Mara look so cute in the opening minutes of “A Ghost Story.” If the movies have taught us anything, it’s this: When lovers are introduced as happy, in five or 10 minutes one of them will be dead. But the movies haven’t prepared us for what happens next: Just as the title promised, the deceased will return as a ghost. And not just a ghost: a ghost wrapped in a white sheet with eye-holes, like a kid trick-or-treating or Geena Davis and Alec Baldwin in the early stretches of “Beetlejuice.”

The dead one is Affleck’s “C,” as the credits bill him. A car crash got him, right outside the Texas country house he shared with Mara’s “M.” He rises from the hospital slab, using the morgue sheet as his new wardrobe, and heads home. He can’t bear to part with M, whose grief is all-consuming. But all he can do is watch. Dead-C can’t speak, and M can’t see or even sense him, which may be for the best since there’s no way this deeply eccentric indie will turn into “Ghost.”

For its first hour, “A Ghost Story” — filmed in secret by David Lowery right after his folksy Hollywood debut, “Pete’s Dragon,” using the stars of his indie “Ain’t Them Bodies Saints” — is a top-notch contribution to the grief genre. It’s right up there with “Truly Madly Deeply,” in which Alan Rickman returns from the dead to hang with his ex (Juliet Stevenson), only to realize his presence makes things worse.

At least they got to talk. Every scene in “A Ghost Story” overflows with unbearable longing that will never be satisfied. C is stuck staring at M when she’s most in need: as she grief-gorges on an entire pie in an unbroken five-minute take; as she vomits it up in a snotty mess; as she remembers the before-time, the two nestled on a couch as he whispers sweet, super-mumbly nothings in her ear. And yet this heartbreaker is also kind of funny? Gutting as it gets, we can never forget we’re watching a dude standing around in bed sheets, saying nothing, literally deadpan — a ghostly Buster Keaton.

Like a romance you hope isn’t doomed, you watch “A Ghost Story” wondering if the good times will end. And they do. The last half-hour is like a bad break-up, which isn’t to say the movie itself turns bad — just more ambitious than it can handle. We won’t spoil it, but there’s a delicate balance between the profoundly sad and the disarmingly funny, and Lowery eventually see-saws the wrong way. His film becomes too cute, too precious, even as it goes overboard to remind us of our place in the cosmos. But you wouldn’t write off a great relationship just because it turned sour. When “A Ghost Story” is on, it’s devastating.