It'd have to be very, very bad gas to keep the engine from idling properly. 87 octane alone wouldn't do it.
First guess would be that the idle control valve or idle hole in the throttle body (not sure which the RX8 uses) has gotten plugged, so there isn't enough airflow, or the drive-by-wire throttle is sticking a bit when closed/almost closed (where any tiny adjustments make the biggest difference). A similar thing could be caused by vacuum leaks causing the idle control to over-compensate or the car to run too lean after starting. Those would be the two places I'd start checking anyway