Actually, I reading a book right now on fish behaviour and it has detailed information on different experiments that scientists have used to determine all aspects of fish behaviour. Anyone interested in it, I could post the book name and author. It goes into what's instinctual, what's biological, and what is learned.
As for fish memory here's a little instance that happened just recently. One of my female nicaraguenses fell sick over a month ago. She's in a species tank with one male and two other females. Each female has her own pit and cave. After falling sick she was moved into a hospital tank and remained there for over a month. For about three weeks, one of the other females and the male would go in and clean out her cave for her, but never spent any amount of time in or around the cave. In the fourth week, this same female decided she would claim this cave and abandon her own. Perhaps this cave is somehow better than her own, and she figured the other female was not coming back. In the fifth week, the formerly sick female was re-introduced, and immediately went to her cave, to discover the other one had claimed it. They fought throughout the night, until the once sick female had reclaimed her cave, and the other female went back to the abandoned cave. Another thing is that the re-introduced female would constantly go up to the male, swim with him and start doing the mating dance for him. Surely if she didn't recognize or remember him, she would probably see him as a threat (he's about 10 inches and twice the size of her) and would try to avoid him.