The former Bluebirds midfielder says he lost his head in previous south Wales derbies, and urged Malky Mackay's men to keep a lid on their emotions in Sunday's game
The Welsh sides meet on Sunday in the first top-flight derby between the pair and McPhail knows all about the intensity of the rivalry.
He was sent off for two bookable offences in consecutive meetings with Swansea at the Liberty Stadium in the 2008-09 season and wants Malky Mackay's men to learn from his mistakes.
"I messed up a couple of times," McPhail, now with Sheffield Wednesday, told WalesOnline. "In my first derby away I made a late, rash tackle during the second half.
"I had totally forgotten I had been booked earlier after a misjudged tackle which put me on the wire.
"In the second match the ball fell to me after what I thought was a good challenge and the referee gave a free kick against us. I kicked the ball away.
"There is no clue in my mind to this day why I did that. I cannot tell anybody why that happened. That's what a derby can do to you. Keeping your head is vital."
With Swansea in ninth and Cardiff sitting 16th, Michael Laudrup's side may be considered favourites, but there is only a two-point gap separating the two and Mackay's side have home advantage.
Swansea were 1-0 winners on their last visit to the Cardiff City Stadium, when Marvin Emnes netted a second-half goal.