You can take ibuprofen while BF (best painkiller/anti-inflammatory for mastitis), so I would assume topical application of ibuprofen gel is totally fine.
This link is very good for what painkillers you can use while pregnant and BF -
www.kellymom.com/health/meds/pain-meds.html
I am assuming you aren't applying it directly to your boobs or nipples, btw! Obviously that wouldn't be a great idea...