Affects Version/s: Minecraft 1.8.7
Fix Version/s: None
I'm not sure how to describe this, so I'll explain what I did. This probably applies to other blocks as well.
1. Open the creative inventory.
2. Place a piston in slot 8.
3. Place a melon in slot 7.
4. Hover over the melon in the hotbar and press 8 to move it to slot 8.
5. Close the creative inventory.
6. Switch to slot 8.
7. When attempting to place the melon, a piston will be placed instead. The melon in the hotbar will also change to a piston.