WARNING: The following contains spoilers for Avengers: Infinity War, in theaters now.
Like the 18 Marvel Cinematic Universe films that came before it, Avengers: Infinity War isn't a direct adaptation of any comic books, but rather inspired by them. First and foremost is the 1991 miniseries The Infinity Gauntlet, where, as in the current blockbuster, Thanos snuffs out half of all sentient life in the universe with a snap of his fingers. There are significant differences between the two stories -- the heroes assembled and the Mad Titan's motivations, for starters -- but there are enough similarities that the comic may provide some important clues to the ultimate defeat of Thanos in Avengers 4, and how dead and disappeared heroes might return.
Surely no one thinks Spider-Man, who has a sequel to headline next year, or Black Panther, who starred in one of the most successful films of all time, is gone for good. Or that Marvel Studios would eliminate most of the Guardians of the Galaxy, at least outside of their own franchise. So, yes, there are ways for them to be brought back, possibly alongside fallen favorites like Loki, The Vision, Gamora and Heimdall.
In Marvel Comics' The Infinity Gauntlet, by Jim Starlin, George Pérez and Ron Lim, Thanos already has the six Infinity Stones (or Gems) when the story begins, and his elimination of half of life in the universe -- intended to win the affections of the physical embodiment of Death -- isn't a cliffhanger, but rather the opening volley. It's what calls heroes, villains and cosmic entities from across creation to unite in opposition to Thanos.
Hawkeye, Black Panther, Daredevil, Luke Cage, The Wasp, the Fantastic Four, Alpha Flight and about 20 additional heroes disappear, leaving Captain America, Iron Man, Doctor Strange, Spider-Man, Thor, the Hulk, The Vision, Scarlet Witch and assorted other characters, most of whom either Marvel doesn't control the film rights to (Silver Surfer, Cyclops Doctor Doom, Wolverine) or else hasn't yet properly introduced (Adam Warlock, for instance) to concoct an elaborate plan to defeat Thanos.
As in the film, the heroes fail, and one by one most of them are killed by Thanos, who, with the Infinity Gauntlet, can't even be stopped by the sudden intervention of the most powerful cosmic beings in the Marvel Universe. Outraged by a betrayal by Death and the demonic Mephisto, the Mad Titan imprisons all of the entities in stasis, and enters a higher plane of existence to confront Eternity, the collective consciousness of every living thing in the universe.