okay its not your head gasket, don't panic or anything..its actually an easy fix you can do your self. your car is misfiring, and lacking fuel pressure. meaning some of your cylinders are not igniting when they should be, an 87 civic doesnt have a sensor for that problem like newer models.
easy fix, what you need is basicly a tune up...primerly ignition tune up. i recomend you get some NGK spark plugs and bosch or NGK wire set to go along. also a new distributer cap is recomended and an ignition coil wire i belive they are called, its the wire that looks like your spark plugs but runs from the distributer to the ignition coil, those usually dont come with the wire set. while you at it i also recomend changing the air filter and perhaps the pcv valve.
now for fuel issue, change your fuel filter..you can do that yourself too, its easy and will prolly take about 30 minutes of under the car labor. i also recomend buying a fuel pressure regulator, its under the hood and might take a while to change but easy to do, for me on a v8 it took me an hour to change my fuel pressure reg., however on a four cylinder car....that will prolly be alot easier as you have much more room to work with.
that happened to my mustang once its a 93 and just like your it doesnt have a sensor for that problem to give out a check engine light, unlike newer cars like my brothers 04 mustang when he had that same problem his turned out it was ignition missfire, and it threw a check engine light out. mine when it happened like it did to my brothers 04 mustang turned out a fuel problem...different problems same results so annoying lol oh well.
i suggest you buying all these parts from a store that offer life time warrenty like autozone. so if they fail again in the future espically spark plugs/wires you can get them for free for life.
if you do not how to do it, have a friend/boyfriend/father/brother etc. do the work for you....men usually are more knowlage about cars and maintance compare to women but i'm not bashing women nor am i calling anyone idiots. men and thier toys (cars)
estimated cost of all parts i just listed about 150 bucks
estimated time about 3 hours of work
money saved from doing it yourself...about 150-250 bucks.
best of luck and drive safe.