The cause of a car running can be for example lack of spark, lack of fuel or lack of compression. Lack of compression generally means expensive engine damage. The cause in your case can be practically anything: for example, bad fuel injectors can cause the symptoms you're seeing. Weak spark can also cause the problems. Consider also vacuum leaks as the potential cause, as a vacuum leak can affect the air/fuel ratio.
Does this car have electronic throttle control? Judging from the year, it might not, as 2002 was around the time when car manufacturers were transitioning to electronic throttle control. If not, the cause can be a bad idle air control valve. This would explain why you got the car running by playing with the gas pedal. The throttle valve allows enough air to get to the engine if you press the gas pedal. Without this, a bad idle air control valve might not let enough air into the engine. If the car has electronic throttle control, you will definitely get a warning light on the dashboard if the system is malfunctioning.
A bad sensor such as the crankshaft position sensor can also cause the issues you're seeing. If the sensor is just barely functioning, the car can run for a while but then stop.
I also had starting troubles with a car that had a failing ECU relay.
Without a check engine light, the diagnosis might be hard.