Oh. Um, well. Coulson was in charge of a SHIELD-run programme called Project T.A.H.I.T.I., made particularly in the event that an Avenger was mortally wounded.
It had so not so pleasant side effects that Coulson had penned a letter to Agent Fury of its shortcomings, but eventually, when Coulson had been shot by Loki, it was used on him. Coulson was clinically dead for days but they revived him with the techniques and technology used in the Project, replacing the memories of the horrific procedure with pleasant ones of him being on a beach vacation.