The answer depends on a lot of variables. If you are really close friends with your ex and your new partner understands this then I would say yes, its okay. In order for this to work though, there have to be strong communication lines open between the new couple. There has to be trust and understanding between both parties and the gift has to be appropriate.
Now if an estranged ex all the sudden shows up and hands over a gift, then the gift should probably be rejected. At minimum if it is received, the new partner needs to be told immediately.