In this study, we demonstrate a robust nonvolatile memristor based on polyethylenimine (PEI) with thermally stable resistive switching behaviors by doping silver ions. This polymeric memristor exhibits remarkable performances with excellent endurance, large ON/OFF ratio, long retention time, and low working voltage. More importantly, the device depicts superior high-temperature environmental stability even when exposed to temperatures up to 100 °C. Moreover, the mechanical properties and typical biosynapse functions of the W/Ag/PEI-AgNO3/Pt/Ti devices on flexible substrate are successfully realized. These results reveal that the W/Ag/PEI-AgNO3/Pt/Ti memristor is promising for wearable and neuromorphic electronics.